Operators Precedence and Associativity
There are 15 precedence categories, some of them contain only one operator. Operators in the same category have equal precedence.
If duplicates of operators appear in the table, the first occurrence is unary and the second binary. Each category has an associativity rule: left-to-right (→
), or right-to-left (←
). In the absence of parentheses, these rules resolve a grouping of expressions with operators of equal precedence.
Precedence | Operands | Operators | Associativity |
---|---|---|---|
15 | 2 | () [] . -> | → |
14 | 1 | ! ~ ++ -- + - * & (type) sizeof | ← |
13 | 2 | * / % | → |
12 | 2 | + - | → |
11 | 2 | << >> | → |
10 | 2 | < <= > >= | → |
9 | 2 | == != | → |
8 | 2 | & | → |
7 | 2 | ^ | → |
6 | 2 | | | → |
5 | 2 | && | → |
4 | 2 | || | → |
3 | 3 | ?: | ← |
2 | 2 | = *= /= %= += -= &= ^= |= <<= >>= | ← |
1 | 2 | , | → |
Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
What do you think about this topic ? Send us feedback!