Home Segments Index Top Previous Next

197: Mainline

In principle, you could rewrite count = count - 1, using an augmented assignment operator, as count -= 1. You are not likely to see such expressions, however, because C offers a still more concise shorthand for adding 1 to, or subtracting 1 from, a variable. To use the shorthand, you drop the equal sign altogether, along with the 1, and prefix the variable with the increment operator, ++, or the decrement operator, --. Thus, you replace count = count - 1 by the following expression:

--count 

Similarly, ++count means increment the value of count by 1.