参数和参量之间的差异 [英] Difference between parameter and argument

查看:815
本文介绍了参数和参量之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个参数和论证之间的差异,或者是他们只是同义词?

Is there a difference between a "parameter" and an "argument", or are they simply synonyms?

推荐答案

参数往往是在实参与形式参数的意义上使用。

Argument is often used in the sense of "actual argument" vs. "formal parameter".

正式参数什么的函数声明/定义/原型给出实际的参数调用函数,形式参数的实例时,发生了什么过去了,如果你会的。

The formal parameter is what's given in the function declaration/definition/prototype, the actual argument is what's passed when calling the function, an instance of a formal parameter, if you will.

话虽这么说,他们经常使用的互换,或取决于语言/社区,而且我还听说实际参数与& C。

That being said, they're often used interchangably, or depending on language/community, and I've also heard "actual parameter" &c.

所以在这里, X 将是正式的参数:

So here, x and y would be formal parameters:

int foo(int x, int y) {
    ...
}

而在这里,在函数调用,5和以Z 是实际的参数:

foo(5, z);

这篇关于参数和参量之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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