From 281a6f4fb80d12244a4d4671e92e7529d18e8957 Mon Sep 17 00:00:00 2001 From: wolfwhocodes <40625914+wolfwhocodes@users.noreply.github.com> Date: Thu, 22 Nov 2018 14:40:27 +0530 Subject: [PATCH] Associativity of operators (#23217) When two or more operators of the same precedence occur in an expression, associativity determines the order in which they must be evaluated. --- guide/english/c/operators/index.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/guide/english/c/operators/index.md b/guide/english/c/operators/index.md index 65d90eaa4a..0fd7a7f511 100644 --- a/guide/english/c/operators/index.md +++ b/guide/english/c/operators/index.md @@ -201,9 +201,13 @@ sizeof() Returns the size of a variable. size ? : Conditional Expression. If Condition is true ? then value X : otherwise value Y -## 6. Operator precedence in C +## 6. Operator precedence and associativity in C Operators with the highest precedence appear at the top of the list. Within an expression, operators -with higher precedence will be evaluated first. +with higher precedence will be evaluated first. When two or more operators of the same precedence is +present in an expression, then the associativity of the operator tells us the order in which the operators +must be evaluated. The associativity in the given list is from left to right i.e, operators in the left are +evaluated first. + - Postfix `() [] -> . ++ --` - Unary `+ - ! ~ ++ -- (type)* & sizeof` - Multiplicative `* / %`