解决warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘int *’

[root@CC c]# gcc MemTest.c -o MemTest1 -Wall
MemTest.c: In function ‘main’:
MemTest.c:24: warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘int *’
MemTest.c:39: warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘int *’

MemTest.c:24: warning: cast from pointer to integer of different size
MemTest.c:39: warning: cast from pointer to integer of different size



代码中增加下面对应颜色的部分
int i, *intptr=NULL;
intptr = (int *)malloc(sizeof(int)*16);
printf("intptr address: 0x%x\n", (unsigned int)(long)intptr);

你可能感兴趣的:(function,Address,different,warning)