What is the solution and how??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the solution and how???

int y=8 ; y+= ++y + y-- + --y ? In blueJ (Java) But the answer is 33

14th Mar 2019, 3:45 PM
Tisa
1 Answer
+ 3
There is no solution because this is undefined behaviour. For c++ the output is: gcc and vc++ y = 31 clang y = 32 For java there probably won't be much difference. Don't use more than 1 increment/decrement operator in 1 expression, it's also very ugly and unreadable.
14th Mar 2019, 4:32 PM
Dennis
Dennis - avatar