I've been searching for this question but they don't really explain my doubt.
int x = 5;
x += ++x;
cout << x;
Answer is 12 instead of 11 (which I thought to be), I came to the conclusion that the ++x is done first right? Means x = 6. Followed by the 6 + 6 = 12. Am I assuming in the right direction?
and
x += x++; //= x + (x++)
cout << x;
Answer is 11, I came to the conclusion that it's = 6 + 5 = 11, am I right?
what about
++x += ++x;
cout<< x;
Answer is 14, so does it mean that the right ++x comes first. Which makes x = 6. Then the left ++x comes into play, which makes x = 7 at this time. After which it process 7 + 7 = 14.
Is this the right assumption?