void main goes against the standard, which says it should be int main, and return 0 on success (though you can leave the return out as return 0 is assumed by the compiler)
Returning 0 indicates success. A program should return 0 when it has finished successfully. Note: the 'main' function in C is declared as int main not void main as it is in Java, therefore an integer value should always be returned upon completion of the program.
Some of the compilers I've used over the years give warnings or error messages when using void as main. I always thought it was good practise to return some value anyway, I normally write back end programs so its always handy to give the front end either the all ok (return 0) or an error message (return CODER_MADE_A_BOTCH)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.