display | more...
The function where execution of a C program starts. On exit from the function, or if exit() or _exit() are called, execution of the program ends. The return value of main() is returned to the environment as an exit status.

The correct definition of main() must be compatible with one of the following declarations:

  • int main(int argc, char *argv[]);
  • int main(void);

Anything else (most particularly, void main() and its variants) are incorrect Schildtisms, and to be avoided at all costs.