Question: 1. (6 points) Consider the following function written in C: int x=3, y=2, z=1; void foo(int a, int b) { x = x + b;

 1. (6 points) Consider the following function written in C: int

1. (6 points) Consider the following function written in C: int x=3, y=2, z=1; void foo(int a, int b) { x = x + b; a = a - b; In each of the cases below, 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. (a) foo(y,z) where all parameters are passed by value (b) foo(y,z) where all parameters are passed by reference (c) foo(y,z) where all parameters are passed by value-result (d) foo(x,y) where all parameters are passed by reference (e) foo(x,x) where all parameters are passed by reference (f) foo(x,x) where all parameters are passed by value-result

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!