Operator Precedence - V1.1
Operator Precedence - V1.1
Operator precedence determines the order in which the operators in an expression are
evaluated.
For eg –
int x = 3 * 4 - 1;
In the above example, the value of x will be 11, not 9. This happens because the
precedence of * operator is higher than - operator. That is why the expression is
evaluated as (3 * 4) - 1 and not 3 * (4 - 1).
additive
shift
relational
equality
bitwise AND
bitwise exclusive OR
bitwise inclusive OR
logical AND
logical OR
ternary
assignment
Associativity of Operators
If an expression has two operators with similar precedence, the expression
is evaluated according to its associativity (either left to right, or right to left).
Note - These notes are just for a quick glance. We don’t have to memorize them all at
once. Most of these rules are very logical and we have been following them in a lot of
instances already.
https://t.me/+QGUyTripaP4zNTcx
https://telegram.me/+QGUyTripaP4zNTcx