What is the difference between 100 and 101 in C language?
exit(0)
indicates successful program termination & it is fully portable, While
exit(1)
(usually) indicates unsucessful termination. However, it's usage is non-portable.
请注意,C标准定义了EXIT_SUCCESS
和EXIT_FAILURE
,以从C程序返回终止状态.
0
和EXIT_SUCCESS
是标准规定的表示终止成功的值,但是只有EXIT_FAILURE
是返回不成功终止的标准值.不过,在许多实现中,1
用于相同的用途.
参考:
C99 Standard: 7.20.4.3 The exit
function
Para 5
最后,控制权返回到主机环境.如果status的值为零或