I know in C++, you can have ++x as an lvalue and that it evaluates to x. But I ran the following code and am curious about what is going on behind the scenes.
x = 10;
++x = x + 5;
In this case the final value of x is now 15. So does cpp not try to evaluate ++x
at all? Or does it do something like storing the result of ++x
in a temporary address and use the old value of x itself when evaluating x+5
and then this value(15) just overwrites the temporary value(11)
There's no particular reason for running such a code and I know that. I am asking this purely out of curiosity