I need to read IP addresses into a char array for working on it later. Since IP octets can be as big as 256, I thought it would be good to use unsigned char array to read them. This is how I intend to use it.
sprintf(buf,"%d.%d.%d.%d",ip24,ip16,ip8,ip);
But it appears that first argument of sprintf should be char* and hence it's throwing the below warning. How do I deal with it.
expected ‘char * restrict’ but argument is of type ‘unsigned char *’
char buf[16]="255.255.255.255"chars. This question indicates a lack of thought about what you're doing.bufis obviously the wrong type. Declare it as achar *rather than anunsigned char*. And depending on the type ofipand friends, you probably want to use%urather than%d(and octets cannot be as large as 256; the valid range is [0,255]).