Question: Consider the following function written in the C syntax: int foo (int a, int b) {a = b + 1; b = x * 2;

Consider the following function written in the C syntax: int foo (int a, int b) {a = b + 1; b = x * 2; return b - a;} In each of the cases below, assume that the initial values of the variables are x=1, y=2, and z=3. Write down the values of x, y and z after the following calls to foo (). If necessary, assume that output arguments are copied back to parameters in the left-to-right order. z = foo (x, y) where all parameters are passed by value z = foo (x, y) where all parameters are passed by reference z = foo(x, y) where all parameters are passed by value-result z = foo(y, y) where all parameters are passed by value z = foo(y, y) where all parameters are passed by reference z = foo(y, y) where all parameters are passed by value-result
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
