Problem 5 20 pts Given the following function and main progr

Problem 5. [20 pts] Given the following function and main program int operation (int a int & b, int c) int r (a 1) 2; return (r) int main int i [2], j 2, k 3; cin i [0]; i [1] i) cout operation (i, j, k) j k; return 0; 5.a [4 pts] Is the argument a passed by value or reference? Answer: 5.b [4 pts] is the argument b passed by value or reference? Answer: 5.c [4 pts] is the argument c passed by value or reference? Answer:

Solution

Answer 5.a):- Argument a is passed by value

Answer 5.b):- Argument b is passed by reference

Answer 5.c):- Argument c is passed by value.

Answer 5.d):- Standard input 2 is needed to get the output will be 1

  operation (i,j,k) will return 2

Answer 5.e):- operation (i,j,k) will return 7, b=10=j or k=3

                   Cout<< operation (i,j,k)+j-k will be 14

---------------------------------------------------------------------------------------------

If you have any query, please feel free to ask.

Thanks a lot

 Problem 5. [20 pts] Given the following function and main program int operation (int a int & b, int c) int r (a 1) 2; return (r) int main int i [2], j 2, k

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site