APPENDIX D

 

Order of Precedence of Operators from Highest to Lowest

Description Operator Associate from
Function expr ( )
Array expr [ ]
struct indirection -> left to right
struct member .
     
Increment/decrement ++ -
One's complement ~
Unary not !
Address & right to left
Dereference *
Cast (data type)
Unary plus/minus + -
Size in bytes sizeof
     
Multiplication, division, and Modulus * / %
Addition, subtraction + -
Shift left/right << >> left to right
Comparisons < <= > >= = = !=
Bitwise and &
Bitwise inclusive or |
Bitwise exclusive or ^
Logical and &&
Logical or ||
     
Conditional ? : right to left
Assignment = %= += -+ *= /=
> >= < <= &= ^= |=
     

Get C Programming for Scientists and Engineers with Applications 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.