Quote:Original post by Andrew Russell
I'm not sure the standard actually says that. Perhaps it does for compatability with very old versions of C. Even so, I'd suggest you should just return anyway as a matter of course.
Well, it's definitely in the final draft. I don't own a copy of the final standard, but the
final draft states in section 3.6.1, paragraph 5:
Quote:A return statement in main has the effect of leaving the main function (destroying any objects with automatic storage duration) and calling exit with the return value as the argument. If control reaches the end of main without encountering a return statement, the effect is that of executing
return 0;
But your suggestion is, naturally, good advice.
Enigma