main()函数及其参数说明
main()函数主要形式:
- int main(void)
- int main(int argc, char *argv[]) = int main(int argc, char **argv)
main()函数的参数说明:
- argc = arguments count
- argv = arguments value/vector
- argc is greater than zero.
- argv[0] will be a string containing the program's name or a null string if that is not available.
- argv[0] through to argv[argc-1] are pointers to strings whose meaning will be determined by the program.
- argv[argc] is a null pointer.
main()函数参数传递方法
方法一:通过 VS 设置
右击项目—>属性—>配置属性—>调试—>命令参数,在命令参数中输入,每个参数之间用空格隔开。
方法二:通过运行或命令提示符窗口
输入程序名 + 参数(使用空格隔开)
来源:https://www.cnblogs.com/zdfffg/p/10862255.html