+ 2
Can anyone explain this ?
#define square (x)(x*x) int main() { x = square (y+1); printf("%d\n",x); return 0 ; }
5 Answers
+ 6
It will be calculate like this if y =1;
x=square (1+1)
square (x) x*x which means 1+1*1+1 so answer will be 3
If it will be x=square (2+4)
Then it will be
2+4*2+3 hope u understood
+ 2
Yes the value of y is 1
+ 2
Thank you . I got it .
+ 1
The answer is 3 but how ?
+ 1
square(y+1) is replaced at compile time by :
(y+1*y+1)
I think y is 1 in your code (you didn't show it here, so I don't know the value of y). So :
1 + 1*1 + 1 = 3