Appendix B. Operator Precedence Charts

Operators are shown in decreasing order of precedence from top to bottom (Figs. B.1B.2).

Table B.1. C operator precedence chart.

C Operator

Type

Associativity

()

parentheses (function call operator)

left to right

[]

array subscript

 

.

member selection via object

 

->

member selection via pointer

 

++

unary postincrement

 

--

unary postdecrement

 

++

unary preincrement

right to left

--

unary predecrement

 

+

unary plus

 

-

unary minus

 

!

unary logical negation

 

~

unary bitwise complement

 

( type )

C-style unary cast

 

*

dereference

 

&

address

 

sizeof

determine size in bytes

 

*

multiplication

left to right

/

division

 

%

modulus

 

+

addition

left to right

-

subtraction

 

<<

bitwise left shift

left to right

>>

bitwise right shift

 

<

relational less than

left to right

<=

relational ...

Get C How to Program, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.