Hierarchy of operators
The Priority or Precedence in which the operators are performed is called the Hierarchy of operators. The associativity specifies the operators direction to be evaluated, it may be left to right or right to left.
|1.||( ) , ++ , --|
|2.||* / %|
|4.||< , > , <= , >=|
|5.||== , !=|
Parentheses have the highest priority. If there are more than one set of parentheses than the inner most parentheses would performed first.
Example 1: 10 + 20 * 2
In the above example, multiply operator has greater precedence than + operator, so, it will execute first than + will be executed. The above expression result is 50.
Example 2: a * b / c
In the above equation * and / are of same priority. So, equation is start from left to right. First multiplication is performed than division.
Example 3: a = b = 5;
Here, it starts from right to left..