I am practicing for my exam in C, and I have problem with this code. It's clear to me that in first printf program displays first unchanged values of x and y. But when we call DO, variable x should change value and accept values of b
because of this (a=b)
, and finally b
should have value of this b=(25)-15
and finally b=10
. But my program displays 15, 15 instead of 15,10. Can some good soul explain me what I am doing wrong here ?
#define DO(a,b) b=(a+b)-(a=b)
int main (void)
{
int x = 10;
int y = 15;
printf ("%d %d\n",x,y);
DO(x,y);
printf ("%d %d\n",x,y);
return 0;
}