+ 5

Please explain me the output of the code...

https://code.sololearn.com/cuCkuZio04oq/?ref=app

26th May 2019, 4:47 AM
Surya Ammisetti
2 Antworten
+ 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
26th May 2019, 5:04 AM
Anna
Anna - avatar
+ 2
Thank you 😊
26th May 2019, 5:16 AM
Surya Ammisetti