[cs13001] main() return value

Mikhail Nesterenko mikhail at cs.kent.edu
Wed Feb 13 19:45:10 EST 2013


CSI students,

There was a discussion about a return value of main(). It should be
integer. The return value of main indicates how the program
exits. This value can be interpreted and acted upon by the programs
that invoke your program.

The return value of zero means that the program exited normally,
non-zero value mean abnormal termination.  If there is no return
statement then main() returns zero.

Even through Microsoft's Visual Studio C++ compiles 

     void main()

It is prohibited by C++ standard and should be avoided.

Thanks,
-- 
Mikhail


More information about the cs13001 mailing list