C standard says that (draft n1570)
5.1.2.2.1 Program startup
The function called at program startup is named
main
. The implementation declares no prototype for this function. It shall be defined with a return type ofint
and with no parameters:int main(void) { /* ... */ }
or with two parameters (referred to here as
argc
andargv
, though any names may be used, as they are local to the function in which they are declared):int main(int argc, char *argv[]) { /* ... */ }
or equivalent;10) or in some other implementation-defined manner.
Now, if a function has return type other than void
then you have to use
return exp;
if its return type is void
then you can use (not necessary)
return;
In case of main
you can use return 0;
but C99 allow you to omit the return statement.