void multiply (int m, int n) {
m = m*n;
cout <<m<< "," <<n<< endl;
}
Suppose the function is called with actual parameters i,j where i=2,j=3. If we are using call-by-value show what is printed when called with:
(a) multiply (i,j) and (b) multiply (i,i).
Now suppose that the parameters could be replaced by call-by-value-result parameters. Repeat parts (a) and (b) and explain the different effect (if any). Assume that the instructions are not executed sequentially.
(b) Suppose a function has the following declaration: void person(char* name, int age); Modify the declaration so that default value for name is unknown and age 20.
fun sqr(n: int)= n*n;and function call sqr(p+q)with p=2 & q=5
Show the binding and evaluation of the function in case of eager, normal-order and lazy evaluation.