程序编译时返回 0 或不返回 0
可能的重复:
C/C++ 中 main() 应该返回什么?
这是一个非常基本的问题问题,我猜。
我已经编程一年了,但我的一个朋友提出了一个相当令人困惑的问题,让我感到惊讶。
在 C++ 上以“int main()”开头的程序似乎可以完美编译,即使使用“return 0;”已删除且不被任何其他返回语句替换。并且根本没有 return 语句,程序仍然显示“Process returned 0”。
这有什么解释吗? 抱歉,如果我的问题很愚蠢!
Possible Duplicate:
What should main() return in C/C++?
This is a pretty basic question, I guess.
I've been programming for a year now but a friend of mine surprised me with a rather stupefying question.
Programs that start with 'int main()' on C++ seem to compile perfectly even with 'return 0;' removed and not replaced by any other return statement. And without a return statement at all, the program still shows that 'Process returned 0'.
Does this have any explanation?
Sorry if my question is silly!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
§3.6.1/5:
§3.6.1/5:
来自 What should main() return in C/C++? 的接受答案
From the accepted answer of What should main() return in C/C++?