Postfix Increment and Decrement Operators: ++, --
postfix-expression :
postfix-expression
++ postfix-expression
--
Operands of the
postfix increment and decrement operators are scalar types that are
modifiable l-values.
The result of the
postfix increment or decrement operation is the value of the
postfix-expression before the increment or decrement operator is applied.
The type of the result is the same as that of the postfix-expression but is
no longer an l-value. After the result is obtained, the value of the operand
is incremented (or decremented).
Example
In the
following example, the
for
loop is iterated 10 times. After each iteration, the
nCount
variable increased by +1 using the postfix increment operator.
//
Example of the postfix increment operator
for
(nCount = 0; nCount < 10; nCount++) {
nTotal += nArray[Count];
} |