+ 4
Pls give explanation for the following
#define square(x) (x*x) int main() { int x,y=1; x=square(y+1); printf("%d",x); return 0; } The output of this code is 3
2 Antworten
+ 2
Basically macro code is replaced in preprocessing phase.
So the square(y+1) becomes (y+1 * y+1)
After that by operator precedence 1+1*1+1 gives result 3
+ 4
1+1*1+1
1*1--> 1
1+1+1 - - > 3