void foo( int x, int y , int z) { int temp = z; z = y; y=x; x = temp;}void main { int k = 1; int j = 3; int t[5] = {1,3,2,3,1}; foo( t[k], t[j] k);}
In the pseudocode above suppose we call x, y and z by value-result. Inside the function the value of z changes so when the function completes k will have a new value. My question relates to the variable that x will copy out to when the function completes. Will it copy its value to x= t[k=1] which was the variable passed at the start or to the new value of k meaning x=t[k=3] . Does the order of the variables matter? If foo was instead foo(int z,int x,int y) then k would copy out first so x would copy out to the matrix using the new value of k?
I tried to simulate the code in C but since it does not support call by value-result I am not sure about the results.