point of arguments in main function
This question already has an answer here:
Depending on what type of application you are developing this may or may not be relevant to you. But arguments are intended for your command line arguments that are passed to the application at run time.
The prototype is
int main (int argc, char ** argv);
If you invoke your application from the command line
./a.out foo bar
Then main
will get passed
argc = 2
argv = {"foo", "bar", NULL}
The other valid prototype for main
is
int main(void);
If you don't want arguments. Any other prototype will be rejected by the compiler.
它们通常用于提供命令行参数。
链接地址: http://www.djcxy.com/p/72186.html上一篇: c无限循环错误
下一篇: 主要功能中的论点点