+ 1

+ operator

Could you explain me please how does it works: int x =9; x+=++x; Console.Write (x);

10th Oct 2019, 6:08 AM
Alexander Volsky
3 Answers
+ 4
While it may be OK for challenge questions etc. in your own code try to avoid writing statements like: x+=++x
10th Oct 2019, 6:52 AM
Sonic
Sonic - avatar
+ 3
X += ++X; means X = X + ++X; X = (9+1) + (1+9); X= 20
10th Oct 2019, 6:35 AM
estifanos
estifanos - avatar
0
x+=++x means x plus x+1= 9+10=19?
10th Oct 2019, 9:01 AM
Alexander Volsky