C – operator precedence.
Here is a list of the operator precedence (order/priority) in the C programming language in descending order. I.e. the operator “parantheses” has the highest precedence of all operators.
Operator | Operation | Evaluated |
---|---|---|
() | parentheses | left to right |
[] | square brackets | left to right |
++ | increment | right to left |
— | decrement | right to left |
(type) | cast operator | right to left |
* | the contents of | right to left |
& | the address of | right to left |
– | unary minus | right to left |
~ | one’s complement | right to left |
! | logical NOT | right to left |
* | multiply | left to right |
/ | divide | left to right |
% | remainder (MOD) | left to right |
+ | add | left to right |
– | subtract | left to right |
>> | shift right | left to right |
<< | shift left | left to right |
> | is greater than | left to right |
>= | greater than or equal to | left to right |
<= | less than or equal to | left to right |
< | less than | left to right |
== | is equal to | left to right |
!= | is 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 |
= | assign | right to left |
+= | add assign | right to left |
-= | subtract assign | right to left |
*= | multiply assign | right to left |
/= | divide assign | right to left |
%= | remainder assign | right to left |
>>= | right shift assign | right to left |
<<= | left shift assign | right to left |
&= | AND assign | right to left |
^= | exclusive OR assign | right to left |
|= | inclusive OR assign | right to left |