+ 8
why output is 3 why why why
// why output is 3 why why why ??? #include <stdio.h> #define square(r) (r*r) int main() { int y = 1; printf("Area is %d\n", square(y+1)); return 0; }
3 RĂ©ponses
+ 13
The macro is : square(1) (1+1*1+1)
So according to operator precedence, multiplication has higher precedence than addition.
So first 1*1 is evaluated then addition is done.
So 1+(1*1)+1 = 1+1+1 = 3
+ 6
Thanks nova
+ 4
It will be calculate like this square(1) (1+1*1+1)
So 1+(1*1)+1 = 1+1+1 = 3