What's wrong with this C code?

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)
 
The uni seem to want it according to the intranet
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) :)
 
Back
Top Bottom