TOC | Prev | Next

Increment and decrement operators

++ and -- increment and decrement.

n--; /* subtract 1 from n */
x++; /* add 1 to x */

Depending on if the operator is prefix or postfix, you get back the
modified or unmodified value.

x = 3;
y = x++; /* y = 3, x = 4 */

x = 3;
y = ++x; /* y = 4, x = 4 */
TOC | Prev | Next