So I have only been learning C for about 3 weeks now and I am using this tutorial to help me understand pointers.
I am writing everything the same as he is but I am using Putty and Vim to write my code. When I compile my code however, it says "warning: format '%p' expects argument of type 'void *'". Why do I have to cast to type 'void *' when in the tutorial he doesn't?
int main()
{
int tuna = 19;
int *pTuna = &tuna;
printf("Address \t Name \t Value \n");
printf("%p \t %s \t %d \n", pTuna, "tuna", tuna);
return 0;
}
I have casted pTuna to "void *" and the program compiles and runs fine but I don't understand why and why in the tutorial the casting isn't necessary.
Thank you for answering!