When an expression is evaluated each operator is processed in a sequence. This doesn't necessarily mean evaluating these operators from left to right. The Priority or Precedence in which the operators are performed is called the Hierarchy of operators.
Priority | Operator | Associativity |
---|---|---|
(Highest) | ( ) | left-to-right |
++, -- | right-to-left | |
* , / , % | left-to-right | |
+ , - | left-to-right | |
<< , >> | left-to-right | |
< , > , <= , >= | left-to-right | |
== , != | left-to-right | |
&& | left-to-right | |
|| | left-to-right | |
(Lowest) | = , *= , /= , %= , += , -= | right-to-left |
Parentheses have the highest priority. If there are more than one set of parentheses than the inner most parentheses would performed first.