[英]What is the different between I put return 0 or don't put on the program
#include <stdio.h>
int main()
{
for (int i = 0; i < 10; i++)
{
printf("%d",i);
}
}
我只是想知道為什么程序的結果是否放return 0;
無論是否在代碼上,結果仍然是正確的。
沒有區別。
根據C標准,可以省略return 0;
在main()
function 上(並且只有那個 function ),它仍然表現得好像有一個return 0;
在最后。
C標准中的確切措辭:
[…]到達終止主 function 的 } 返回值 0。
來自 n2346 §5.1.2.2.3 程序終止。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.