EXPLANATION:
simply trying to convert a a char to hexadecimal but i keep getting this error and I'm not sure how to get around this
PROBLEM:
warning: passing argument 1 of ‘strtol’ makes pointer from integer without a cast[cs214111@cs lab3]$ vi lab3.c
CODE:
void print_group(char array[])
{
int num,a;
char ch[10];
printf("here ");
for (a = 0 ; a < 8 ; a++)
{
strcpy(ch,array[3]);
num = strtol(ch,0,16);//------------------THIS IS IT//
printf("%i",num);
}
}
You are passing char
where char *
is expected, maybe
strcpy(ch, &array[3]);
But from your code it would seem like this, is what you actually need
num = strtol(&array[3], 0, 16);
if strcpy()
works in this case, then this will work.