I have to compile code in C89 for class, I wrote this code to see if it would compile. I compile it using,
gcc -std=c89 -pedantic
#include<stdio.h>
int main(void)
{
int number;
printf("%p", &number);
}
this code would compile just fine on a system with gcc version 4.1.2, but on a machine with version 5.3(Ubuntu 5.3), it would give me the error
warning:format '%p' expects argument of type 'void *', but argument 2 has type 'int *' [-Wformat=]
If anyone can give me a work around I would really appreciate it. Thank you
%d
or%p
? Are you trying to print the value or the address ofnumber
?