'%d' expects argument of type 'int', but argument 2 has type 'long unsigned int' [-Wformat=] [duplicate]
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: How can one print a size_t variable portably using the printf family? 12 answers I keep getting compile warnings but I don't know how to fix it: '%d' expects argument of type 'int', but argument 2 has type 'long unsigned int' [ The program runs fine but I still get the compile warnings: /* Sizeof.c--Program to tell byte size of the C variable */ #include int main(void) { printf("\nA Char is %d bytes", sizeof( char )); printf("\nAn int is %d bytes", sizeof( int )); printf("\nA short is %d bytes",