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: ", argc - 1); 10 11 for (int count = 1; count != argc; ++count) 12 printf("%d: %s ", count, argv[count]); 13 14 printf(" "); 15 16 return 0; 17 }