必须int main()函数返回一个值在所有编译器? [英] Must the int main() function return a value in all compilers?

查看:235
本文介绍了必须int main()函数返回一个值在所有编译器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么在C ++的某些编译器中使用int main()时不需要包含return语句?关于Turbo C ++?

Why is it not necessary to include the return statement while using int main() in some compilers for C++? What about Turbo C++?

推荐答案

在C ++中,在C99和C11中,控制流到达 main 函数的结尾,则函数impliclty返回 0

In C++, and in C99 and C11, it is a special rule of the language that if the control flow reaches the end of the main function, then the function impliclty returns 0.

这篇关于必须int main()函数返回一个值在所有编译器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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