       Next: Bit operations Up: Keywords, Operators and Declarations Previous: Keywords

## Operators

At last, here is a table of operators and precedence.

The lines of the table are in order of precedence, so `a * b + 6' is interpreted as `(a * b) + 6'. When in doubt put brackets in!

The Associativity column shows how the operators group. E.g. `<' groups left to right, meaning that a<b<c is equivalent to (a < b) < c rather than a < (b < c). Both are pretty useless expressions.

Associativity Operator
left to right `() [], ->, .`
right to left `!` (negation), `~` (bit-not)
`++, --, - (unary) , * (unary), & (unary), sizeof`
right to left cast `(type)`
left to right `*, /, % (modulus)`
left to right `- +`
left to right `<<, >>`
left to right `<, <=, >, >=`
left to right `==, != `
left to right `&` (bit-and), `|` (bit-or)
left to right `^` (bit-xor)
left to right `&&` (logical and)
left to right `||` (logical or)
right to left `?:`
right to left `=, +=, -=, /=, %=, >>=, &=`
left to right `,`    Next: Bit operations Up: Keywords, Operators and Declarations Previous: Keywords
Tim Love
1999-10-06