main()
{
printf("Hello World.");
}
Run Code Online (Sandbox Code Playgroud)
为什么在gcc编译器中没有产生警告,即使我们声明main()返回类型为'int'
dan*_*n04 14
因为您没有使用-Wall标志.当你这样做时,你应该得到:
foo.c:1: warning: return type defaults to ‘int’
foo.c: In function ‘main’:
foo.c:1: warning: implicit declaration of function ‘printf’
foo.c:1: warning: incompatible implicit declaration of built-in function ‘printf’
foo.c:1: warning: control reaches end of non-void function
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
305 次 |
| 最近记录: |