Operation Execution Priorities and Order

Top 

 

Priorities are the same for each group of operations listed in the table below. The higher the priority of operation, the higher is its place in the table.

If there are no brackets and the operations are related to the same group, then the order of execution determines the operation and operand grouping (from left to right or from right to left).

Examples

The expression of a * b / c is equivalent to the expression of (a * b) / c,

as the operations are executed from left to right.

The expression of a = b = c is equivalent to the expression of a = (b = c),

as the operation is executed from right to left.

[]   Array element selection

!    Logical negation                  From right to left (RL)

~    Bit-by-bit negation

-    Sign change

++   Increasing by one

--   Decreasing by one

(type) Type conversion

sizeof Determining of size in bytes

*    Multiplication                        LR

/    Division

%    Modulus division

+    Addition                              LR

-    Subtraction

<<   Left shift                            LR

 Right shift

<    Less than                             LR

<=   Less than or equal to

>    Larger than

>=   Larger than or equal to

==   Equal to                              LR

!=   Not equal to

&    Bit-by-bit AND operation              LR

^    Bit-by-bit exclusive OR operation     LR

|    Bit-by-bit OR operation               LR

&&   Logical AND operation                 LR

||   Logical OR operation                  LR

=

*=  /=  %=  +=  -=

<<=  >>=  &=  ^=  |=