Associativity defines the concept where operators occur in an expression with the same precedence. For example, in expression a + b âˆ’ c, both + and â€“ have the same precedence, then the associativity of such operators determines which part of the expression will be evaluated first. Both + and âˆ’ are left associative here, so the expression will be calculated as **(a+b) âˆ’c**.

PrecedenceÂ andÂ associativityÂ defineÂ theÂ orderÂ inÂ whichÂ anÂ expressionÂ isÂ evaluated.Â

Sr.No | Operator | Precedence | Associativity |

1 | Exponentiation ^ | Highest | Right Associative |

2 | Multiplication ( * ) and Division ( / ) | Second Highest | Left Associative |

3 | Addition ( + ) and Subtraction ( – ) | Lowest | Left Associative |

The above table describes the default behavior of operators. The order can be modified at any stage in the expression evaluation, using parenthesis. For example Â âˆ’

In **x + y * z,**Â the expression element** y*z** is evaluated first, with the precedence of multiplication over addition. We use parenthesis here for first evaluation of **x + y**, like** (x+y)*z**