在使用 GCC 编译我的程序时,我收到以下警告:
format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int
现在只是通过尝试,我意识到 %lo 修复了警告。但是我真的不明白我在做什么。
是否有命名约定来获取类型的缩写形式?比如int是%d,为什么??
谢谢!
最佳答案
long unsigned int = unsigned long
您使用 %lu
来打印它们。
同样,%llu
用于unsigned long long
。
%d - int
%u - unsigned
%ld - long
%lld - long long
%lu - unsigned long
%llu - unsigned long long
关于C long unsigned int 的简写形式是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9365946/