哪里的main()返回其价值? [英] where does main() return its value?

查看:190
本文介绍了哪里的main()返回其价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚使用code :: Blocks的MinGW的+编译
如果我没有在节目的最后类型的返回0,我可以看到main()函数返回一些整数,我了解到的main()返回0推断程序执行successfully.I没有找到我的$ C的任何缺陷$ C,为什么它返回一些整数?

I'm newly using CODE::BLOCKS+mingw compiler If I don't type return 0 at the end of program,I can see that main() is returning some integer,I learnt that main() returning 0 infers program executes successfully.I don't find any flaw in my code, why is it returning some integer?

其次
任何函数其值返回到其函数调用,到哪里呢main()的返回它的价值?

secondly any function returns its value to its function call, to where does main() return its value?

推荐答案

C ++标准说,如果你没有明确返回一个值,编译器必须生成code,如果你输入了:

The C++ Standard says that if you don't explicitly return a value, the compiler must generate code as if you had typed:

return 0;

究竟是什么的返回值的装置,以及它如何被返回是实施方式特定的。对于大多数操作系统中,返回值变为过程的出口code

Exactly what the return value means and how it is returned is implementation specific. For most OSs, the return value becomes the exit code of the process.

这篇关于哪里的main()返回其价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆