为什么当我尝试这样做:无法打印的sizeof一个符号int类型
#include <stdio.h>
int main()
{
printf("Size of int: %d bytes\n",sizeof(int));
return 0;
}
我得到这个:
warning: format "%d" expects argmuments of int type, but the second argument is of type "long unsigned int..."
如果计数,(?)我的操作系统是12.4版64位的Ubuntu。 编译器是:GNU GCC编译器,IDE是Code :: Blocks。
为了好奇心,我在另一台运行不良Win7的机器上运行相同的代码,结构也是64位,我得到的结果是int的大小,而不是上面的警告。
我不认为微软试图解析一个'printf'的格式来查看参数是否正确。 –