I tried to solve this problem in some test, but later when i ran it at home, it gave unexpected answer. I am not able to understand this code:
#include <stdio.h>
#include <conio.h>
#define swap(a,b) temp=a; a=b; b=temp;
int main()
{
int i, j, temp;
i=5;
j=10;
temp=0;
if( i > j) //evaluates to false
swap( i, j );
printf( "%d %d %d", i, j, temp); //expected output: 5 10 0
getch();
return 0;
}
Output i am getting is: 10 0 0
Please someone explain how is it working.