+ 5
Please explain me the output of the code...
2 Respuestas
+ 11
PRODUCT(x) replaces "x" with "x*x"
i is 3
j is PRODUCT (i + 1)
= (3+1*3+1) = (3+3+1) = 7
k is PRODUCT (i++)
= i++*i++
It's illegal to use several increments/decrements in a statement like that. From here, the result is undefined and you might get different output in different compilers.
Here, the expression seems to be evaluated as 3*4 = 12
i is 5 after two increments
l = PRODUCT (++i)
same problem as above, undefined behavior
i is incremented before the multiplication takes place => two increments, i is 7 now
7*7 = 49
https://stackoverflow.com/questions/949433/why-are-these-constructs-using-pre-and-post-increment-undefined-behavior
+ 2
Thank you 😊