int facto (int n)
{
…….
}
Here ‘n’ is a formal parameter that is declared in the function
header.
int facto (5);
Here, 5 is the actual parameter being passed.
Example
19:
Distinguish between call by value and call by reference.
Solution 19:
The following are the points of difference between the two:
Call by Value
Call by Reference
(1) In this method, the value of the variables is passed to the
called function.
(1) In this method, the address of the variables is passed to the
called function.
(2) In the called function, the values are received in a similar type
of variable.
(2) As the address of the variable is received in the called
function, it is also received in a pointer variable.
(3) Only one value can be returned by these functions.
(3) More than one value can be returned to the function.
(4) The syntax is:
t = gcd(u, v);
(4) The syntax is:
gcd (&u, &v);
Do'stlaringiz bilan baham: