+ 1

What should be the output and why?

int y=4; int x = ++y + ++y; cout<<x;

8th Aug 2019, 4:28 PM
Mukul
Mukul - avatar
2 Answers
+ 8
Mukul increment and decrement problems are depends on how compiler read the statement with pre and post increment and decrement. In the mentioned snippet answer would be 12 as last updated value of y would be 6
8th Aug 2019, 4:37 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 1
GAWEN THANKS FOR EXPLAINING
8th Aug 2019, 4:39 PM
Mukul
Mukul - avatar