0
What is difference between int main and void main?
4 Answers
+ 2
When we return 0 at the end ( while using int as the return type) it tells the OS that the program is functional and is without any error(except logical error), as main function is called by OS and it returns 0 to the OS. In C++, there is no difference, both are same.
+ 2
void main means that your program returns nothing to the OS that preempted your program to run but if there are any significant non-zero errors you want to return then int main is the way to go, the OS will report the int error as an error that you should be able to them identify as coming from your program, int main is what is used in the industry for this reason
+ 1
int main returns a value through "return 0;" statement when it's works done!
but the void main doesn't return any value and when it's works done, after the '}' character of main, it will stop (end of application) automatically
however the void main will be done when you use "return;" statement in anywhere of your main's body.
+ 1
feedback or not.
Return value is used for checking excution status of the program.