本文共 255 字,大约阅读时间需要 1 分钟。
argc是命令行总的参数个数;
argv[]是argc个参数,其中第argv[0]是程序的全名,以后的参数是命令行后面跟的用户输入的参数,比如:void main(int argc,char *argv[]){ printf("%d\n",argc); printf("%s\n",argv[0]); printf("%s\n",argv[1]); printf("%s\n",argv[2]);}
执行时敲入:./test abc defg
程序输出:3./testabcdefg
转载地址:http://mqigi.baihongyu.com/