一、问题 运行下面这串代码是出现以下警告 long num = 100; printf("%d\n",num); ``format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=] 二、解决 改成 printf("%ld\n",num) 完美解决 三、总结 长整型用 %ld 来打印 整形用 %d 来打印 希望下次记住,别再犯同样的错误!!!