Search for question
Question

Consider the following function written in the C syntax: 1. int foo(int a, int b) { bb 10:+ 3.a = b*2; 4.return a + b; In each of the cases below, assume that the initial values of the vari-ables are x-1, y=2, and z=3. Write down the values of x, y, andz after the following calls to foo(). If necessary, assume that outputparameters are copied back to arguments in the left-to-right order. (a) z foo(x,y) where all parameters are passed by value= (b)=foo(x,y) where all parameters are passed by reference (c) Z =foo(x,y) where all parameters are passed by value-result (d)=foo(y,y) where all parameters are passed by value (e) z = foo(y,y) where all parameters are passed by reference (f) :Zfoo(y,y) where all parameters are passed by value-result

Fig: 1

Fig: 2

Fig: 3

Fig: 4

Fig: 5

Fig: 6

Fig: 7

Fig: 8

Fig: 9

Fig: 10

Fig: 11

Fig: 12