+ 1

why main function return integer value?

1st Jan 2017, 10:34 AM
shashant bartwal
shashant bartwal - avatar
4 Respuestas
+ 7
The c++ compiler will display an error message if your main() is not of type int.
1st Jan 2017, 10:50 AM
Hatsy Rei
Hatsy Rei - avatar
+ 6
Because main() is actually a function of return type int.
1st Jan 2017, 10:47 AM
Hatsy Rei
Hatsy Rei - avatar
0
but if we change return type?
1st Jan 2017, 10:49 AM
shashant bartwal
shashant bartwal - avatar
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
2nd Jan 2017, 8:00 AM
franco belfiore
franco belfiore - avatar