0
question about a C constant definition
#define square(x)(x*x) int main(){ int x,y=1; x=square(y+1); printf("%d",x); return 0; } in this code isnt the printed value suppoesed to be 4? The answer states it is 3.
1 Odpowiedź
0
No.
squire(y+1) is replaced by its definition of macro as
(y+1*y+1) and y =1 then
=>(1 +1*1+1)
= (1+1+1)
= 3.
Macro definition just replaced as it is before evaluating...