Hey guys, I am studying some C from K&R book and I just play around with these. Anyway, I have a question.
Lets say this is a macro I have gotten.
#define ADD(X,Y)(X+Y)
(I know it will be wiser to code it: #define ADD(X,Y)((X)+(Y)) )
so when I get:
int x = 100, y = 3;
int z = ADD(x,++y);
printf("x %d y %d z %d\n",x,y,z);
x = 100; y = 3;
z = ADD(x+,+y);
printf("x %d y %d z %d\n",x,y,z);
why do I get a different results? I mean, the compiler during the pre-processing should replace ADD(x,++y) and ADD(x+,+y) with x+++y. Thus, they should give the same result.
Thanks in adv.