The precedence table in C programming with descriptions is listed below. You can use the following precedence to work with values comparison, assignment, etc.
Description | Operator | Associativity |
---|---|---|
Function expression | () | Left to Right |
Array Expression | [] | Left to Right |
Structure operator | -> | Left to Right |
Structure operator | . | Left to Right |
Unary minus | - | Right to left |
Increment/Decrement | ++ -- | Right to Left |
One's compliment | ~ | Right to left |
Negation | ! | Right to Left |
Address of | & | Right to left |
Value of address | * | Right to left |
Type cast | (type) | Right to left |
Size in bytes | sizeof | Right to left |
Multiplication | * | Left to right |
Division | / | Left to right |
Modulus | % | Left to right |
Addition | + | Left to right |
Subtraction | - | Left to right |
Left shift | << | Left to right |
Right shift | >> | Left to right |
Less than | < | Left to right |
Less than or equal to | <= | Left to right |
Greater than | > | Left to right |
Greater than or equal to | >= | Left to right |
Equal to | == | Left to right |
Not equal to | != | Left to right |
Bitwise AND | & | Left to right |
Bitwise exclusive OR | ^ | Left to right |
Bitwise inclusive OR | | | Left to right |
Logical AND | && | Left to right |
Logical OR | || | Left to right |
Conditional | ? : | Right to left |
Assignment | = *= /= %=
+= -= &= ^= |= <<= >>= |
Right to left |
Comma | , | Right to left |