Main function
From cppreference.com
A program shall contain a global function called main
, which is the designated start of the program.
int main () { body }
|
(1) | ||||||||
int main ( int argc, char *argv[]) { body }
|
(2) | ||||||||
[edit] Explanation
argc | - | the number of arguments passed to the program from the environment in which the program is run. |
argv | - | These arguments are passed as null-terminated multibyte strings in argv[0] through argv[argc-1], the value of argv[argc] is 0. |
body | - | the body of the main function. As a special case, if control reaches the end of main without encountering a return statement, the effect is that of executing return 0; |