|
发表于 2021-4-15 11:32:09
|
显示全部楼层
- #include<stdio.h>
- #include<math.h>
- //typedef enum {true=1,false=0}bool;
- void test4(char *s)
- {
- printf("我是主函数传参第三个参数:\n %s\n",s);
- }
- void test3(char *s)
- {
- printf("我是主函数传参第二个参数:\n %s\n",s);
- }
- void test2(char *s)
- {
- printf("我是主函数传参第一个参数:\n %s\n",s);
- }
- void test1(char *s1,char *s2,char *s3)
- {
- test2(s1);
- test3(s2);
- test4(s3);
- }
- int main(int argc, char* argv[])
- {
- if (argc<4)
- {
- printf("本程序至少需要三个参数\n");
- return 0;
- }
- test1(argv[1],argv[2],argv[3]);
- return 0;
- }
- /*
- PS D:\我> ./wp1
- 本程序至少需要三个参数
- PS D:\我> ./wp1 1
- 本程序至少需要三个参数
- PS D:\我> ./wp1 1 2
- 本程序至少需要三个参数
- PS D:\我> ./wp1 1 2 3
- 我是主函数传参第一个参数:
- 1
- 我是主函数传参第二个参数:
- 2
- 我是主函数传参第三个参数:
- 3
- PS D:\我>
- */
复制代码 |
|