0

What's the output and why?

int x=2; ++x+=x; cout <<x;

16th Dec 2016, 1:58 PM
vipul chandra
vipul chandra - avatar
2 Answers
+ 3
6 x = 2 ==> 2 ++x ==> 3 (++ before operand ==> do this operation first) x += x ==> 6
16th Dec 2016, 2:04 PM
Sara Majidzadeh
Sara Majidzadeh - avatar
0
6
9th Feb 2017, 7:09 PM
Utkarsh Mohan
Utkarsh Mohan - avatar