For example, in the expression

x = a + b * c;

the first "+" operator still first determines its left operand ("a" in this case) and then its right operand. But in this case the right operand consists of the expression "b*c". The multiplication operator "*" has a higher precedence than the additive "+".

Precedence can be overridden with parentheses, e.g.

x = (a + b) * c;

will force the addition of b to a, and then this sum is multiplied by c.

The table shown in image below is organised from higher precedence to low, when you traverse from top to the bottom of the table.

## 0 comments :

Post a Comment