Main (int Argc,char *argv[])
1.ARGC is an integer
2.ARGV pointer to pointer (can be understood as:char **argv or:char *argv[] Or:char argv[][], argv is an array of pointers )
Note: the main () parenthesis is a fixed notation.
3. Here is an example to understand the use of these two parameters:
Assuming that the program name is prog,
When only prog is entered, the parameters that are transmitted by the operating system are:
Argc=1, which indicates that there is only one program name.
ARGC has only one element, Argv[0] points to the program path and name of the input:./prog
When input prog para_1, there is a parameter, then the parameters transmitted by the operating system are:
Argc=2, which indicates that there is a parameter in addition to the program name.
Argv[0] points to the program path and name of the input.
ARGV[1] points to the parameter para_1 string.
When the input prog para_1 para_2 has 2 parameters, the parameters that are transmitted by the operating system are:
Argc=3, which indicates that there are 2 parameters in addition to the name of the program.
Argv[0] points to the program path and name of the input.
ARGV[1] points to the parameter para_1 string.
ARGV[2] points to the parameter para_2 string.
4.void Main (int argc, char *argv[])
Char *argv[]: argv is an array of pointers, the number of his elements is argc, which holds pointers to each parameter
Reference: http://blog.csdn.net/yukiooy/article/details/4682989 (click on the link to view detailed instructions and relevant examples)
C language Command line parameter argc,argv[] Detailed