aliman.c:3:1: warning: return type defaults to ‘int’ [-Wreturn-type]
main()
^
aliman.c: In function ‘main’:
aliman.c:9:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘double’ [-Wformat=]
printf("%1d\n",nc);
^
aliman.c:13:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
关于main的返回类型的警告是因为main()是一个过时的快捷方式,在现代 C 中你需要编写 int main() . (如果你很迂腐,就把它设为 int main(void)。)最后一个警告说没有 return。声明——main函数必须返回一个值(通常,它表示程序是成功还是失败)。这两个主题都将在 §1.7 中介绍。