User`s manual

Dynamic C Users Manual digi.com 231
13. OPERATORS
An operator is a symbol such as +, , or & that expresses some kind of operation on data. Most operators
are binary—they have two operands.
Some operators are unary—they have a single operand,
although, like the minus sign, some unary operators can also be used for binary operations.
There are many kinds of operators with operator precedence. Precedence governs which operations
are performed before other operations, when there is a choice.
For example, given the expression
will the + or the * be performed first? Since * has higher precedence than +, it will be performed first.
The expression is equivalent to
Parentheses can be used to force any order of evaluation. The expression
uses parentheses to circumvent the normal order of evaluation.
Associativity governs the execution order of operators of equal precedence. Again, parentheses can cir-
cumvent the normal associativity of operators. For example,
Unary operators and assignment operators associate from right to left. Most other operators associate from
left to right.
a + 10 // two operands with binary operator "add"
-amount // single operand with unary “minus”
a = b + c * 10;
a = b + (c * 10);
a = (b + c) * 10;
a = b + c + d; // (b+c) performed first
a = b + (c + d); // now c+d is performed first
int *a(); // function returning a pointer to an integer
int (*a)(); // pointer to a function returning an integer