Precedence and Associativity
table of operators in c programming language

Category

Operator

Name

Associativity

1


( )
[ ]
.
>

Function call
or brace
Array
subscription
Member access(struct
and union)
Pointer
member access(struct and union)

Left to
right

2

Unary

!
~
+

++

*
&
sizeof

Logical NOT
1's complement
Binary plus
Binary
Increment
Decrement
Deference
Reference
Returns size of data or type

Right to left

3

Multiply

*
/
%

Multiplication
Division
Modular
division

Left to
right

4

Addition

+


Binary plus
Binary minus

Left to right

5

Shift

<<
>>

Left shift
Right shift

Left to
right

6

Comparison

<
>
<=
>=

Less than
Greater than
Less than equal to
Greater than equal to

Left to right

7

Equality

==
!=

Equal to
Not equal to

Left to
right

8


&

Bitwise AND

Left to right

9


^

Bitwise XOR

Left to
right

10




Bitwise OR

Left to right

11


&&

Logical AND

Left to
right

12




Logical OR

Left to right

13


?:

Conditional

Right to
left

14

Assignment

=
+=
=
*=
/=
%=
&=
=
^=
<<=
>>=

Equal to
Assign plus
Assign minus
Assign multiplication
Assign division
Assign modular division
Assign bitwise AND
Assign bitwise OR
Assign bitwise XOR
Assign left shift
Assign right shift

Right to left

15


,

Comma

Left to
right

No comments:
Post a Comment