question I got in a Midterm (ASAP)

this is a question a got in a midterm and i couldn't figure out the answer yet:


consider this :

int x, y, z

given this line of codes :

z = x;
x = y;
y = z;

which of the following BEST describe the code ?

A. it swaps the values in variables x and y.
B. it swaps the values in variables y and z.
C. it swaps the values in variables x and z.
D. it rotates the value among the variables x,y and z.




Could you show a little effort.
i wrote the memory line and the answer would be C, but then again im not sure if all the variables swap back and forth
It might help if you do a quick check to see which variable's original values are actually used. That would probably give you enough to answer the question, actually.
Topic archived. No new replies allowed.