首页 > 编程语言 > 详细

C++ - main()函数参数

时间:2019-05-14 15:14:15      阅读:110      评论:0      收藏:0      [点我收藏+]

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 设置
右击项目—>属性—>配置属性—>调试—>命令参数,在命令参数中输入,每个参数之间用空格隔开。

方法二:通过运行或命令提示符窗口
输入程序名 + 参数(使用空格隔开)

C++ - main()函数参数

原文:https://www.cnblogs.com/zdfffg/p/10862255.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!