#include <stdio.h>
int main(int argc, char** argv) {
printf("argc=%d\n",argc);
for (int i = 0;i < argc; i++) {
printf("%s\n",argv[i]);
}
return 0;
}
在命令行(Linux)输入一下命令去编译运行test.c
gcc test.c -o test
./test 1 2 3 4 5
argc = 6
./test
1
2
3
4
5
原文:https://www.cnblogs.com/DengSchoo/p/12600035.html