Overall this is bad programming and should never ever be used in actual code because it is easy to get lost in all the pre and post increments.
But here is the basic explanation.
simple enough:
x = 20
Here is where it gets messy:
y = ++(20) + ++(++(20)) + (++(++(20)))++
Pre increment --> ++x
Post increment --> x++
Pre increments happen inside the evaluation and post
increments happen after the evaluation.
So that statement can be reduced in the following steps.
y = 21 + ++(21) + (++(21))++
y = 21 + 22 + (22)++
y = 21 + 22 + 22
y = 65
After all these increments x = 23. In the statement above though, x equals multiple
numbers because of all the pre and post increments.
Moral of the story, don't ever do this and pre increments take place before the expression is evaluated and post increments take place after the expression is evaluated.