Node:Expressions and operators, Next:Parameters, Previous:Scope, Up:Top
Thinking in C. Short strings of code.
An operator is a character or string of characters used as a built-in function. We have already experimented with one operator in C: the cast operator.
An operator is so called because it takes one or more values and
operates on them to produce a result. For example, the addition
+ can operate on the values 4 and 5 to produce the
result 9. Such a procedure is called an operation, and any value
operated on (such as 4 and 5 in this example) is called an
There are many operators in C. Some of them are familiar, such as the
+ and subtraction operator
operators can be thought of as belonging to one of three groups,
according to what they do with their operands:
100 + 500, or the multiplication operator
12 * 2.
<and the greater-than operator
The majority of operators fall into the first group. The second group is a subset of the first set; in this second set, the result of an operation is a Boolean value (a value of either true or false).
C has about forty different operators. The chief object of this chapter is to explain the basic operators in C. We will examine more complex operators in another chapter. (See Advanced operators.)