<<split from here>>
I have a question about the following code:
Code:
int x = 0, y = 1, z;
int i;
for ( i = 0; i < 10; i++ ) {
printf ( "F(%d): %d\n", i, x );
z = x + y;
y = x;
x = z;
}
I switched the values for x and y so the sequence would display 0 as the first.
I understand everything except
Code:
z = x + y;
y = x;
x = z;
So when it runs through the first time, z becomes 0+1=1. but what I don't understand is how y=x and x=z..
It seems to me that x equals 0, making y =0, then making z, which is 1 equal x. So you have 0 and 1 again.
Can anyone explain to me the logic of this sequence?