想象一下*main() is also a function which is called by something else (like another FunctioN)*the arguments to it is decided by the FunctioN*the second argument is an array of strings*the first argument is a number representing the number of strings*do something with the strings也许一个示例程序会有所帮助。int main(int argc,char *argv[]){ printf("you entered in reverse order:\n"); while(argc--) { printf("%s\n",argv[argc]); }return 0;}它只是以相反的顺序将您输入的所有内容打印为args,但是您应该制作新的程序来做更多有用的事情。编译它(如打个招呼),从终端运行它的参数如下./hello am i here然后尝试对其进行修改,以使其尝试检查两个字符串是否彼此相反,那么您将需要检查argc参数是否恰好为三个,如果还有其他内容会打印错误if(argc!=3)/*3 because even the executables name string is on argc*/{ printf("unexpected number of arguments\n"); return -1;}然后检查argv [2]是否与argv [1]相反,并打印结果./hello asdf fdsa应该输出they are exact reverses of each other最好的例子是文件复制程序,就像cpcp file1 file2cp是第一个参数(argv [0]而不是argv [1]),大多数情况下,除非需要引用或其他内容,否则应忽略第一个参数如果您制作了cp程序,则您确实了解了主要参数...