Precedence of Operators :
S.No | Category | Operator | Description |
1 | Highest | ( )
[ ] |
Function call
Array subscript |
2 | Unary | !
+ – ++ — & sizeof |
Logical Not
Unary plus Unary minus Pre or post increment Pre or post decrement address returns size of operand in bytes
|
3 | Multiplicative | *
/ % |
Multiply
Divide Remainder(modulus)
|
4 | Additive | +
– |
Binary plus(addition)
Binary minus(subtraction)
|
5 | shift | <<
>> |
shift left
shift right |
6 | Relational | <
<= > >= |
Less than
Less than or equal to Greater than Greater than or equal to |
7 | Equality | = =
!= |
Equal to
Not equal to
|
8 | & | Bit wise AND | |
9 | ^ | Bit wise XOR | |
10 | | | Bit wise OR | |
11 | && | Logical AND | |
12 | || | Logical OR | |
13 | Conditional | ?: | (a?x:y means “if a is true, then x else y”) |
14 | Assignment | =
* = / = %= += – = |
Simple assignment
Assign product Assign quotient Assign remainder Assign sum Assign difference
|
15 | Comma | , | Evaluate |