What is operator precedence
Operator precedence and associativity in C language
Below is the table for operator precedence and associativity in C programming language.
[ ]
( )
.
->
++ -- Array subscript
Function Call
Structure reference
Structure dereference
Postfix increment/Postfix decrement
Left to right
++ --
+ -
! ~
(type)
* &
sizeof Prefix increment/Prefix decrement
Unary plus/Unary minus
Logical negation/One's complement
Typecast operator
Pointer dereference/Address of
Size of type/variable in bytes
Right to left
* / % Multiplication/Division/Modulo Left to Right
+ - Addition/Subtraction Left to Right
<< >> Bitwise left shift/ Bitwise right shift Left to Right
< >
<=
>= Comparison less than/Comparision greater than
Comparison less than or equal to
Comparison greater than or equal to
Left to Right
== != Comparison equal to/Comparison not equal to Left to Right
& Bitwise AND Left to Right
^ Bitwise XOR Left to Right
| Bitwise OR Left to Right
&& Logical AND Left to Right
|| Logical OR Left to Right
?: Ternary Conditional Operator Right to Left
=
*= /= %=
+= -=
<<= >>=
&= ^=
|= Assignment Operator
Mulplication/division/modulo assignment
Addition/Subtraction assignment
Bitwise left shift/right shift assignment
Bitwise AND/XOR assignment
Bitwise OR assignment
Right to Left
, Comma Operator Left to Right
Comments
Post a Comment