问个简单的问题,可能只需几秒钟 argc和argv里的 c和 v代表什么?

时间:2022-11-28 17:41:13
int main( int argc, char **argv )中的argc和argv里的 c和 v代表什么?

c是指count吗?
v 指什么?

21 个解决方案

#1


argc为命令行中的参数个数,其中包括命令名本身.argv变量为一个指针,它指向一个指向char的指针

#2


人家问的是什么英文名的缩写,我猜:
c:count
v:value

#3


value or vector?

#4


c是指count吗?
v 指什么?
----
c估计是count,v是variable,可变的。

#5


嘿嘿,看错-_-

#6


zz

c估计是count,v是variable,可变的。

#7


c:count
v:value or vector

#8


count:指参数个数;
value:指参数的值;

#9


同意楼上的

#10


无聊呀

#11


c没有疑问吧
v我觉得应该是vector
摘自《C++编程思想》:
  “数组可以是任何一种类型,包括指针数组。事实上,想给程序传递命令行参数时,C和C++的函数main()有特殊的参数表:
     int main(int argc,char* argv[]){//...
   第一个参数的值是第二个参数的数组元素个数。”
                   ~~~~~~~~~~~~~~~~~~~~
所以我觉得是vector 

#12


感觉没有意义呀

我一般喜欢写做:
int
main(int i,char** c)
{
}

这样多简单...

#13


5.10 Command-line Arguments
In environments that support C, there is a way to pass command-line arguments or parameters to a program when it begins executing. When main is called, it is called with two arguments. The first (conventionally called argc, for argument count) is the number of command-line arguments the program was invoked with; the second (argv, for argument vector) is a pointer to an array of character strings that contain the arguments, one per string. We customarily use multiple levels of pointers to manipulate these character strings.

《The C programming Language》

可见是:vector

#14


int main( int argc, char **argv )

整型  主函数(整型  参数数目, 字符型 ** 参数向量)

如果c语言能这样用中文编程就好了,又简单表意又清楚

#15


对,前面的是存参数的数目,后面的是存参数的值
比如main.exe 12 23
argc就是3
argv[0]是main.exe
argv[1]是12
argv[2]是23

#16


vary

#17



c:count
v:value

#18


C是参数的个数,包括函数名,至少有一个;
V是参数的值的字符指针变量;

#19


我觉得 v 为  value 的可能较大,C 语言最早出现时编程里有没有 vector 的概念,所以 vector 的可能不大, 至于其它就有些牵强了

#20


我觉得 v 为  value 的可能较大,C 语言最早出现时编程里有没有 vector 的概念,所以 vector 的可能不大, 至于其它就有些牵强了

#21


哈哈,考古还是编程
 有意思。

#1


argc为命令行中的参数个数,其中包括命令名本身.argv变量为一个指针,它指向一个指向char的指针

#2


人家问的是什么英文名的缩写,我猜:
c:count
v:value

#3


value or vector?

#4


c是指count吗?
v 指什么?
----
c估计是count,v是variable,可变的。

#5


嘿嘿,看错-_-

#6


zz

c估计是count,v是variable,可变的。

#7


c:count
v:value or vector

#8


count:指参数个数;
value:指参数的值;

#9


同意楼上的

#10


无聊呀

#11


c没有疑问吧
v我觉得应该是vector
摘自《C++编程思想》:
  “数组可以是任何一种类型,包括指针数组。事实上,想给程序传递命令行参数时,C和C++的函数main()有特殊的参数表:
     int main(int argc,char* argv[]){//...
   第一个参数的值是第二个参数的数组元素个数。”
                   ~~~~~~~~~~~~~~~~~~~~
所以我觉得是vector 

#12


感觉没有意义呀

我一般喜欢写做:
int
main(int i,char** c)
{
}

这样多简单...

#13


5.10 Command-line Arguments
In environments that support C, there is a way to pass command-line arguments or parameters to a program when it begins executing. When main is called, it is called with two arguments. The first (conventionally called argc, for argument count) is the number of command-line arguments the program was invoked with; the second (argv, for argument vector) is a pointer to an array of character strings that contain the arguments, one per string. We customarily use multiple levels of pointers to manipulate these character strings.

《The C programming Language》

可见是:vector

#14


int main( int argc, char **argv )

整型  主函数(整型  参数数目, 字符型 ** 参数向量)

如果c语言能这样用中文编程就好了,又简单表意又清楚

#15


对,前面的是存参数的数目,后面的是存参数的值
比如main.exe 12 23
argc就是3
argv[0]是main.exe
argv[1]是12
argv[2]是23

#16


vary

#17



c:count
v:value

#18


C是参数的个数,包括函数名,至少有一个;
V是参数的值的字符指针变量;

#19


我觉得 v 为  value 的可能较大,C 语言最早出现时编程里有没有 vector 的概念,所以 vector 的可能不大, 至于其它就有些牵强了

#20


我觉得 v 为  value 的可能较大,C 语言最早出现时编程里有没有 vector 的概念,所以 vector 的可能不大, 至于其它就有些牵强了

#21


哈哈,考古还是编程
 有意思。