int f(float i, float j, float k)
{
float x=i;
i=j;
j=k;
k=x;}
main(){
float x=5; y=10 z=25;
if(...){
f(x,y,z);
}
else{
f(y,z,y); /* what's x,y,z after this line using call-by-reference and call-by-name mechanism*/
}
}
I think I have a pretty good understand about these three passing mechanism.
After f(x,y,z). x,y,z will have value
10 25 5 if it is call by reference
5 10 25 if it is call by value
10 25 5 if it is call by value result.
(I double checked answer, I am sure those are corrent)
but my answer is completely wrong for f(y,z,y). I got 10,25,10 for call by reference and call by name. How would value of x,y,z change after f(y,z,y) if it is using call by reference and call by name