HP C A.06.05 Reference Manual
Expressions and Operators
Increment and Decrement Operators (++, --)
Chapter 5112
#include <stdio.h>
int main(void)
{
int j = 5, k = 5, l = 5, m = 5;
printf("j: %d\t k: %d\n", j++, k--);
printf("j: %d\t k: %d\n", j, k);
printf("l: %d\t m: %d\n", ++l, --m);
printf("l: %d\t m: %d\n", l, m);
}
The result is as follows:
j: 5 k: 5
j: 6 k: 4
l: 6 m: 4
l: 6 m: 4
The results show that the
initial
values of j and k are used in the first printf(). They also
show that l and m are incremented and decremented, respectively,
before
the third printf()
call.