RAVINDRA'S BLOG

Friday, 2 February 2018

Operator Precedence

Operator:

Operators are nothing but used for making the mathematical calculations or evaluating the values in Programming.
Symbols between two  numbers or between to characters are operators.

Precedence :

Precedence means giving the priority according to importance (or)
Making things in an order, either high to low or low to high.

Operator Precedence :

Operator Precedence is nothing but arranging the operators according to the priority of the operator.
Below are the table :

Operator Description Associativity
++ -- Suffix/post fix increment and decremented Left-to-right
() Function call
[] Array sub scripting
. Structure and union member access
-> Structure and union member access through pointer
++ -- Prefix increment and decrement Right-to-left
"+"  "-" Unary plus and minus
! ~ Logical NOT and bitwise NOT
* Indirection
& Address-of
* / % Multiplication, division, and remainder Left-to-Right
+ - Addition and subtraction
<< >> Bitwise left shift and right shift
< <= For relational operators < and ≤ respectively
> >= For relational operators > and ≥ respectively
== != For relational = and ≠ respectively
& Bitwise AND
^ Bitwise XOR (exclusive or)
| Bitwise OR (inclusive or)
&& Logical AND
|| Logical OR
= Simple assignment Right-to-Left
+= -= Assignment by sum and difference
*= /= %= Assignment by product, quotient, and remainder
<<= >>= Assignment by bitwise left shift and right shift
&= ^= |= Assignment by bitwise AND, XOR, and OR
, Comma Left-to-right