Some C++ compilers allow the main function to have return type void. But doesn\'t the Operating System require int type value returned to specify
But doesn't OS require int type value returned to specify whether program
ended well or not?
Why would it always? On windows when you double click on the icon, the process dies after it ends. OS do not check for the return type there. Even on linux if you just run the binary as ./runBinary, it simply runs and exits. The OS do not show message by itself that it fails or succeeds.
All the above answers are right that the standard says it is int, but some compilers allow void too.