In C++, 3.6.1 Main function
(3.6.1/5) 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;
Can I do the following in C99 without return 0?
int main() { }
Yes, as of C99, reaching the
}at the end of main returns 0 if the return type ofmainis compatible withint.