int main的含义(int _argc,char * _argv []) [英] Meaning of int main( int _argc, char *_argv[] )

查看:84
本文介绍了int main的含义(int _argc,char * _argv [])的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用普通的英语是什么意思?

What does this mean in plain English?

int main( int _argc, char *_argv[] )



我有一个小小的,如果进一步下降取决于它,我无法弄清楚....



I have a small if further down that depends on it and i can''t figure it out....

if ((argc>=4) && (strcmp(argv[3], "m")==0))
			more=1;
		//**********************************
		result = atoi(argv[2]);
		packetCount=0;

推荐答案

用简单的英语来说,_argc表示参数数量在应用程序调用所使用的命令行中,_argv是命令行中的字符串参数数组.

该代码示例有点奇怪,因为仅使用了参数#2和#3.和#0和#1被忽略.也许这是一个不完整的示例.

这就是Microsoft解释命令行的方式: http://msdn.microsoft.com/en-us/library/17w5ykft.aspx [ ^ ].

另请参阅: http://msdn.microsoft.com/en-us/library/6wd819wh.aspx [ ^ ].

这是解析命令行的简单教程: http://www.cplusplus.com/forum/articles/13355/ [ ^ ].

—SA
In plain English, _argc means number of arguments in the command line used at the call of the application, _argv is the array of string arguments in the command line.

The code sample is a bit weird as only arguments #2 and #3 are used; and #0 and #1 ignored. Maybe this is an incomplete sample.

This is how Microsoft explains command line: http://msdn.microsoft.com/en-us/library/17w5ykft.aspx[^].

See also: http://msdn.microsoft.com/en-us/library/6wd819wh.aspx[^].

Here is a simple tutorial on parsing command line: http://www.cplusplus.com/forum/articles/13355/[^].

—SA


Main是一个返回int的函数,它带有2个参数-第一个告诉它在命令行上传递了多少个参数,第二个是指向每个参数的指针数组.

即argc(ount)和argv(alues)
Main is a function that returns int, it takes 2 parameters - the first tells it how many arguments were passed on the command line, the second is an array of pointers to each of the arguments.

I.e argc(ount) and argv(alues)


感谢您的回答对我有很大帮助
thanks ur answers helped me alot


这篇关于int main的含义(int _argc,char * _argv [])的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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