首页 > 代码库 > 解决warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘int *’
解决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);
解决warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘int *’
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。