Professional Documents
Culture Documents
Operator precedence defines the order in which operators are evaluated in an expression,
while associativity determines the direction in which operators are grouped when they
have the same precedence level.
Highest Precedence:
1. () - Parentheses
2. [] - Array subscript
4. . - Member access
9. +, - - Addition, Subtraction
15. | - Bitwise OR
17. || - Logical OR
Lowest Precedence:
**Associativity**:
- **Left Associativity**: Operators with left associativity are grouped from left to right. For
example, the `+` operator has left associativity, so `a + b + c` is evaluated as `(a + b) + c`.
- **Right Associativity**: Operators with right associativity are grouped from right to left.
For example, the `=` operator has right associativity, so `a = b = c` is evaluated as `a = (b =
c)`.