C ++ - INT主(INT ARGC,字符** argv的) [英] C++ - int main(int argc, char** argv)

查看:142
本文介绍了C ++ - INT主(INT ARGC,字符** argv的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  什么是主要的正确申报?

什么是我们在这个函数的参数是什么意思?什么是他们试图告诉我们什么?

What do we mean by the arguments in this main function? What are they trying to tell us?

INT主(INT ARGC,字符** argv的)

更新:并,为code的类似于此的preceding行 INT主(INT ARGC,CHAR *的argv [])?如果是这样,我们怎么能说的char ** argv的类似于的char * argv的[] 因为他们不 ŧ类似于从的阵列的观点?

UPDATE: And, is the preceding line of code similar to this int main(int argc, char* argv[])? If so, how can we say that char** argv is similar to char* argv[] as they don't look similar from an array point of view?

它是如何与相比INT主要()不具有任何参数?

How is it compared with int main() which does not have any arguments?

感谢。

推荐答案

ARGC 参数中指定的命令行选项的数量,包括可执行文件名,可执行文件时被调用。个别命令行选项是的argv 阵列,这是 NULL 终止中发现的(使用的名称和路径来调用可执行文件是的argv [0] )。

The argc parameter is the number of command line options specified, including the executable name, when the executable was invoked. The individual command line options are found in the argv array, which is NULL terminated (the name and path used to invoke the executable is in argv[0]).

两个版本之间的差别只是如果要解析命令行参数或不 - 如果你不感兴趣,那么你可以使用第二种形式忽略它们。

The difference between the two versions is simply if you want to parse command line arguments or not - if you are not interested in them then you can ignore them using the second form.

这篇关于C ++ - INT主(INT ARGC,字符** argv的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆