next up previous contents
Next: The conditional expression Up: Assignment and Logical Previous: The cryptic part

The cryptic arithmetic operator

Another useful but cryptic operator is the arithmetic operator. This operator is used to modify any variable by some constant value. The first statement of the "arithmetic operator" group of statements simply adds 12 to the value of the variable "a". The second statement does the same, but once again, it is not intuitive that they are the same. Any of the four basic functions of arithmetic, "+", "-", "*", or "/", can be handled in this way, by putting the function desired in front of the equal sign and eliminating the second reference to the variable name. It should be noted that the expression on the right side of the arithmetic operator can be any valid expression, the examples are kept simple for your introduction to this new operator.

Just like the incrementing and decrementing operators, the arithmetic operator is used extensively by experienced C programmers and it would pay you well to understand it.



Admin.NET
Mon Feb 20 10:44:07 MET 1995