exit(0)与exit(1)有什么区别啊?

YOUNGCEN 2002-04-03 12:55:10
exit(0)与exit(1)有什么区别啊?
谢谢!
...全文
58 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
2ndboy 2002-04-03
  • 打赏
  • 举报
回复
表示是正常退出(0)还是异常退出(1)
prototype 2002-04-03
  • 打赏
  • 举报
回复
void exit(int status);
Terminates program normally. Functions installed using atexit are called (in reverse order to that in which installed), open files are flushed, open streams are closed and control is returned to environment. status is returned to environment in implementation-dependent manner. Zero or EXIT_SUCCESS indicates successful termination and EXIT_FAILURE indicates unsuccessful termination. Implementations may define other values.

usually, EXIT_SUCCESS == 0, EXIT_FAILURE = 1.
test09test 2002-04-03
  • 打赏
  • 举报
回复
exit(0)正常退出,其他数值(包括1)表示你想显示的各种错误返回。
linjiework 2002-04-03
  • 打赏
  • 举报
回复
exit 里的参数是你程序的返回值。
你想返回多少都行,一般是返回零表示正常退出,非零表示出现错误。

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧