参数和参数之间的区别
“参数”和“参数”之间有区别吗,或者它们只是同义词?
Is there a difference between a "parameter" and an "argument", or are they simply synonyms?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
“参数”和“参数”之间有区别吗,或者它们只是同义词?
Is there a difference between a "parameter" and an "argument", or are they simply synonyms?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
参数通常在实际参数与形式参数的意义上使用。
形式参数是在函数声明/定义/中给出的内容原型,而实际参数是调用函数时传递的内容 - 如果您愿意的话,可以是形式参数的实例。
话虽如此,它们通常可以互换使用,它们的确切用途取决于不同的编程语言及其社区。例如,我也听说过实际参数等。
所以这里,
x
和y
将是形式参数:而这里,在函数调用中、 5 和
z
是实际参数:Argument is often used in the sense of actual argument vs. formal parameter.
The formal parameter is what is given in the function declaration/definition/prototype, while the actual argument is what is passed when calling the function — an instance of a formal parameter, if you will.
That being said, they are often used interchangeably, their exact use depending on different programming languages and their communities. For example, I have also heard actual parameter etc.
So here,
x
andy
would be formal parameters:Whereas here, in the function call, 5 and
z
are the actual arguments:一般来说,参数是函数内部使用的参数,参数是调用函数时传递的值。 (除非您采取相反的观点 - 维基百科在讨论参数和参数时提到了替代约定)。
在我的论文中,x 是 sqrt() 的参数,2.0 是参数。
这些术语经常至少在某种程度上可以互换使用。
Generally, the parameters are what are used inside the function and the arguments are the values passed when the function is called. (Unless you take the opposite view — Wikipedia mentions alternative conventions when discussing parameters and arguments).
Under my thesis, x is the parameter to
sqrt()
and 2.0 is the argument.The terms are often used at least somewhat interchangeably.
它们在文本中经常互换使用,但在大多数标准中,区别在于参数是传递给函数的表达式,其中参数是函数声明中声明的引用。
They are often used interchangeably in text, but in most standards the distinction is that an argument is an expression passed to a function, where a parameter is a reference declared in a function declaration.
参数和参数不同
因为参数在程序中使用不同的值并且
参数传递相同的值
在程序中,因此它们在 C++ 中使用。
但c没有区别。 c 中的参数和参数是相同的。
Arguments and parameters are different
in that parameters are used to different values in the program and
The arguments are passed the same value
in the program so they are used in c++.
But no difference in c. It is the same for arguments and parameters in c.