int main(void)
{
int a = 10;
int *p1 = &a;
char ch = 'c';
char *p2 = &ch;
printf("p1=>size:%d p2=>size:%d\n",
sizeof(p1), sizeof(p2));
return 0;
}
Ubuntu编译后的warning
src/pointer_basic.c: In function ‘main’:
src/pointer_basic.c:26:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
sizeof(p1), sizeof(p2));
^
src/pointer_basic.c:26:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Wformat=]