Operator Precedence and Associativity

In C operators are executed in a definite sequence dictated by their precedence. If more than one operator has the same precedence then the order they are executed is based on their associativity. Listed here are all the C operators in order of precedence.

Operator Type Operators Associativity
Expression ( ) [ ] . -> Left to right
Unary - ~ ! * & ++ -- sizeof Right to left
Multiplicative * / % Left to right
Additive + - Left to right
Shift << >> Left to right
Relational (inequality) < <= > >= Left to right
Relational (equality) == != Left to right
Bitwise AND & Left to right
Bitwise XOR ^ Left to right
Bitwise OR | Left to right
Logical AND && Left to right
Logical OR || Left to right
Conditional ? : Right to left
Assignment = *= /= %= += -= <<= >>= &= |= ^= Right to left