C Postfix Increment and Decrement Operators
Operands of the postfix increment and decrement operators are scalar types that are modifiable l-values.
Syntax
postfix-expression
:
postfix-expression
++
postfix-expression
--
The result of the postfix increment or decrement operation is the value of the operand. After the result is obtained, the value of the operand is incremented (or decremented). The following code illustrates the postfix increment operator.
if ( var++ > 0 )
*p++ = *q++;
In this example, the variable var
is compared to 0, then incremented. If var
was positive before being incremented, the next statement is executed. First, the value of the object pointed to by q
is assigned to the object pointed to by p
. Then, q
and p
are incremented.
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for