+ 1
why main function return integer value?
4 Answers
+ 7
The c++ compiler will display an error message if your main() is not of type int.
+ 6
Because main() is actually a function of return type int.
0
but if we change return type?
0
that's it's what the standard , for historical reason, foresee., The return value on main is also called program exit code and that value is often used to notify an error situation to the operating system or to a program that launch the execution of our program. normally exit code 0 means normal end of program whereas other values can be used to report an error situation