C Operators

Many of C's operators, such as the plus sign, work exactly like those in other languages. Nevertheless, C's rich collection of operators requires some review so that you can grasp what C is all about. This section provides a quick overview of some of C's more interesting operators.

C supports increment and decrement operators. In Chapter 12, "Program Algorithms," you learned about the concept of adding or subtracting 1 (one) to or from a variable to keep track of a count. C's ++ and -- operators add and subtract 1, respectively, from whatever variable you apply them to. The following statements add 1 to the variables a, b, and c:

a++;
b++;
c++;

The following statements decrease a, b, and c by one:

a--;
b--;
c--;

C also supports ...

Get Absolute Beginner's Guide to Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.