#include<stdio.h>
int main(int argc,char **argv)
{
int i;
for(i = 0;i<argc;i++)
{
printf("argument(%d) is %s!\n",i,argv[i]);
}
printf("=========\n");
printf("argc is %d\n",argc);
printf("=========\n");
return 0;
}
[root@J01051386 Test_20180418]# ./a.out a b c
argument(0) is ./a.out!
argument(1) is a!
argument(2) is b!
argument(3) is c!
=========
argc is 4
=========
由上可知:argv[i] 是代表的命令行内的参数值
argc是代表命令行内参数的个数。