第 11 章 字符串和字符串函数(命令行参数)

 1 /*---------------------------------------
 2     repeat.c -- 带参数的 main()
 3 ---------------------------------------*/
 4 
 5 #include <stdio.h>
 6 
 7 int main(int argc, char *argv[])
 8 {
 9     printf("The command line has %d arguments:\n", argc - 1);
10 
11     for (int count = 1; count != argc; ++count)
12         printf("%d: %s\n", count, argv[count]);
13     
14     printf("\n");
15     
16     return 0;
17 }
repeat.c

posted @ 2018-06-01 15:27  web1013  阅读(144)  评论(0编辑  收藏  举报