Di Posting Oleh : Simple Learning
Kategori : Associativity table Operator Associativity
Operator Associativity in C++
The order in which the operators of same precedence are evaluated is called Operator associativity. It tells the compiler that if some operators of same precedence level are there then how the expression is evaluated (from left - to - right or right - to -left).
Operator Associativity Table
Example:
Consider the expression: 5+6-9-2+7. In this expression , plus and minus operators have same precedence level. Here, operators associativity rule (described in row no. 4 of the table ) is used to evaluate this expression.it es evaluated as follows:
5+6 -9-2+7
11-9-2+7
2-2+7
0+7
so 7 will be the answer of expression.
for more Explanation
visit this link:
http://cs.smu.ca/~porter/csc/ref/cpp_operators.html
The order in which the operators of same precedence are evaluated is called Operator associativity. It tells the compiler that if some operators of same precedence level are there then how the expression is evaluated (from left - to - right or right - to -left).
Operator Associativity Table
Operators Associativity |
Consider the expression: 5+6-9-2+7. In this expression , plus and minus operators have same precedence level. Here, operators associativity rule (described in row no. 4 of the table ) is used to evaluate this expression.it es evaluated as follows:
5+6 -9-2+7
11-9-2+7
2-2+7
0+7
so 7 will be the answer of expression.
for more Explanation
visit this link:
http://cs.smu.ca/~porter/csc/ref/cpp_operators.html
0 Response to "What is operator associativity in C++"
Post a Comment