C语言中入口参数是什么

出口参数又是什么?

以下以 C 语言为例,其余语言与之有类似之处:

A function is uniquely represented by a name and a set of operand types.
Its operands, referred to as parameters, are specified in a
comma-separated list enclosed in parentheses. The actions that the
function performs are specified in a block, referred to as the function
body. Every function has an associated return type.

函数由函数名以及一组操作数类型唯一地表示。函数的操作数,也即形参,在一对圆括号中声明,形参与形参之间以逗号分隔。函数执行的运算在一个称为函数体的块语句中定义。每一个函数都有一个相关联的返回类型。

As an example, we could write the following function to find the greatest common divisor of two ints:

考虑下面的例子,这个函数用来求出两个 int 型数的最大公约数
// return the greatest common divisor

int gcd(int v1, int v2)

{

while (v2) {

int temp = v2;

v2 = v1 % v2;

v1 = temp;

}

return v1;

}

Here
we define a function named gcd that returns an int and has two int
parameters. To call gcd, we must supply two int values and we get an int
in return.

这里,定义了一个名为 gcd 的函数,该函数返回一个 int 型值,并带有两个 int 型形参。调用 gcd 函数时,必须提供两个 int 型值传递给函数,然后将得到一个 int 型的返回值

————C++ Primer 4th Edition

可以将形参理解为入口参数,返回值理解为出口参数
话说,现在应该基本上不使用“入口参数”/“出口参数”这样的说法了吧
温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网