Question: Consider the following program written in C-like syntax. Assume that print just prints the indicated values. Show the output of this program for each of
Consider the following program written in C-like syntax. Assume that print just prints the indicated values.

Show the output of this program for each of the following parameter passing methods. If there is any ambiguity, make appropriate assumptions and state what they are. Notice that 8 numbers will be printed out.
1.pass-by-value
2.pass-by-value-result
3.pass-by-reference
int i; int a[4]; void swap (int x, int v) x=x-y; main () a[0] = 3 [1] = 2 a[2] = 6; [3] = 0; swap (i,a[i]); print(i, a[o], a[1], a [2]) swap (a[i],a[i]); print(i, a[o], a[1], a [2]) return O
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
