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
C++ does not allow main
to have a void
return type. The published C++ standard requires it to be int
. Some C++ compilers allow you to use void
, but that's not recommended. In general, the OS doesn't care one way or the other. A specific OS might require a program to give a return value, but it doesn't necessarily have to come from main
's return value. If the C++ compiler allows void
, then it probably provides some other means of specifying the program's exit code.