[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
5.9.2 Self & prefix operators
As in C, each of the arithmetic operators +
, -
, *
,
/
, %
, and ^
can be used as a self operator.
The prefix operators ++
(increment by one) and --
(decrement
by one) are also defined.
For example,
int i=1; i += 2; int j=++i;
is equivalent to the code
int i=1; i=i+2; int j=i=i+1;
However, postfix operators like i++
and i--
are not defined
(because of the inherent ambiguities that would arise with the --
path-joining operator). In the rare instances where i++
and i--
are really needed, one can substitute the expressions
(++i-1)
and (--i+1)
, respectively.