0
How the output of this code i.e value of x is 3 at the end of the program.
Please someone explain it . https://code.sololearn.com/cs980PfqcJHR/?ref=app #include <stdio.h> #define square(x)(x*x) int main() { int x,y=1; x=square(1+y); printf("%d\n",x); return 0; }
3 Respostas
+ 2
Because define just copy & pastes what was defined.
So it goes
square(1+y) = (1+y*1+y) = (1+2*y) = (1+2*1) = 3
I have explained it in more detail here:
https://code.sololearn.com/c80ech3GBNvc/?ref=app
+ 2
Thank you so much
both of you