(1) The first int represents the return value of the entire main function, and if the function is executed normally, returns 0, and the exception returns 1.
(2) int ARGC represents the total number of command line parameters, since is the number, that is the integer type, that is: int;
(3) char* ARGC representative program under the Linux terminal parameter assignment, the passed parameters will be saved to argc[] character array;
(4) When the value is passed, the different parameters are separated by a space (this is the rule);
(5) When the value is passed, the first parameter is assigned to ARGV[1], when the value is passed, the second parameter is assigned to ARGV[2], and when the value is passed, the third parameter is assigned to ARGV[3] ...;
(6) Argv[0] represents the file name and path name of the program (the individual expresses the understanding on the line, do not delve into);
(7) After the pass value is finished, press ENTER, at this time ARGC will recognize the number of parameters;
Attach code and procedures:
1#include <stdio.h>2 intMainintargcChar*argv[])3 {4 inti;5printf"argc =%d\n\n", argc);6 for(i=0; i<argc;i++)7 {8printf"argv[%d]:%s\n", I,argv[i]);9 }Ten One return 0; A}
1#include <stdio.h>2 intMainintargcChar*argv[])3 {4 intI=0;5 while(i!=3)6 {7printf"argv[%d]:%s\n", I,argv[i]);8i++;9 }Ten One return 0; A}
int main (int argc,char* argv[]) Simple comprehension