why does the output become like this:

x=2, y=3, z=4

x=3, y=2, z=4

x=4, y=2, z=3 <<< referring to this

x=2, y=4, z=3

when int_swap(&x,&z)

then int_swap will be int_swap(2,4) ?

then

t = 2;

*x = 4;

*y = 2;

so x=4, y=3, z=2 ??

What am i misunderstanding?

same with the final output, it doesnt make sense!

:-(

Code:#include <stdio.h> void int_swap(int*, int*); int main(int argc, char **argv) { int x=2, y=3, z=4; printf( "main: x=%2d, y=%2d, z=%2d\n", x, y, z); int_swap(&x, &y); printf( "main: x=%2d, y=%2d, z=%2d\n", x, y, z); int_swap(&x, &z); printf( "main: x=%2d, y=%2d. z=%2d\n", x, y, z); int_swap(&y, &x); printf( "main: x=%2d, y=%2d, z=%2d\n", x, y, z); return 0; } void int_swap( int *x, int *y ) { int t; t = *x; *x = *y; *y = t; }