|++||x++||x + 1|
|—||x–||x – 1|
Note that with unary operators you can have post-increment and pre-increment.
x++ is post-increment; the number is incremented by 1 after everything else in the statement has occurred. If you wrote it as
++x (a pre-increment) x would be increased by 1 before everything else.
So, we have:
number = 10; newNumber = ++number;
In this case both
newNumber would be 11. This is because the statement increases
number by 1, making it 11, and then makes
newNumber equal to it. If you did:
number = 10; newNumber = number++;
number would be equal to 11, because
newNumber is set to the value of
number first, which is 10, before it is incremented by 1.