什么是用C出口(0)和出口(1)有什么区别? [英] What is the difference between exit(0) and exit(1) in C?
问题描述
谁能告诉我?是什么区别退出(0)
和退出C语言(1)
?
Can anyone tell me? What is the difference between exit(0)
and exit(1)
in C language?
推荐答案
什么是退出(0)
和退出之间的差异(1)
C语言?
What is the difference between exit(0)
and exit(1)
in C language?
退出(0)
表示成功的程序终止和放大器;它是完全可移植的,虽然结果退出(1)
(通常)表示不成功的终止。然而,它的使用是不可移植的。
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程序返回的终止状态。
Note that the C standard defines EXIT_SUCCESS
and EXIT_FAILURE
to return termination status from a C program.
0
和 EXIT_SUCCESS
是标准规定的数值来表示成功的终止,然而,只有 EXIT_FAILURE
是返回不成功的终止标准值。 1
用于相同的许多实现,但。
0
and EXIT_SUCCESS
are the values specified by the standard to indicate successful termination, however, only EXIT_FAILURE
is the standard value for returning unsucessful termination. 1
is used for the same in many implementations though.
参考:
C99标准:7.20.4.3的退出
函数结果
第5段
最后,控制被返回到主机环境。如果状态的值是零或
EXIT_SUCCESS
,状态成功终止实施德科幻奈德形式
回。如果状态值为 EXIT_FAILURE
,实施德科幻奈德形式
的状态返回不成功的终止。否则,返回的状态是
实施德网络定义。
Finally, control is returned to the host environment. If the value of status is zero or
EXIT_SUCCESS
, an implementation-defined form of the status successful termination is returned. If the value of status isEXIT_FAILURE
, an implementation-defined form of the status unsuccessful termination is returned. Otherwise the status returned is implementation-defined.
这篇关于什么是用C出口(0)和出口(1)有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!