66 - Shorthand Operators
perators Involving LValues (i.e. a variable or something that can be assigned to)
-
a += e
is equivalent toa = a + e
. The operators -=, *=, /=, %=, |=, &= and ^= are defined accordingly -
a++
anda--
are equivalent toa += 1
/a -= 1
but the expression itself still has the previous value of a -
In contrast,
--a
and++a
have the same effect on a but return the value after the change
- LValues -> Assigned To
a += e
isa = a + e
a++
/a--
->a += 1
&a -= 1
--a
/++a
->a += 1
&a -= 1
- Expr -> Modified Value