It's hard to start with everything. Let's start with the main function.
1. Each C ++ProgramMust contain the main function
2. The operating system calls the main function to execute the program, and the main function is the only function shown and called by the operating system.
3. In most systems, the return value of the main function is a status indicator. If 0 is returned, the execution is successful. Other non-zero return values have their own definitions for each operating system.
When you want to introduce the parameters of the main function, you cannot see the relevant introduction. When you are wondering, you can see a small note in this article: Section 7.2.6 describes other parameters that can be defined in the main function. So go there:
Main function with parameters:
Int main (INT argc, char * argv [])
{........
}
It can also be expressed:
Int main (INT argc, char ** argv)
{........
}
Argc indicates the number of strings in the argv array. The first element of argv is usually the name of the program. The following elements pass additional strings to main. For example:
Argv [0] = "prog"
Argv [1] = "-d"
...........