Node:Hidden operators and values, Next:The comma operator, Previous:Advanced operators, Up:Advanced operators

### Hidden operators and values

Many operators in C are more versatile than they appear to be at first glance. Take, for example, the following operators:

`=`

`++`

`--`

`+=`

`-=`

These operators can be used in some surprising ways to make C source code elegant and compact. (See Expressions and operators, if you need a refresher in what they do.) All of them can form expressions that have their own values. Such an expression can be taken as a whole (a "black box") and treated as a single value, which can then be assigned and compared to other expressions, in effect, "hidden" within another expression.

The value of an expression is the result of the operation carried out in the expression. Increment and decrement statements have a value that is one greater than or one less than the value of the variable they act upon, respectively.

Consider the following two statements:

c = 5; c++;

The expression `c++`

in the above context has the value 6.

Now consider these statements:

c = 5; c--;

The expression `c--`

in the above context has the value 4.