[go: up one dir, main page]

0% found this document useful (0 votes)
59 views1 page

Precedence PDF

This document describes C operator precedence and associativity. It lists C operators from highest to lowest precedence and whether they associate left-to-right or right-to-left. Parentheses have the highest precedence and associate left-to-right, while assignment operators have the lowest precedence and associate right-to-left.

Uploaded by

kazimir92
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views1 page

Precedence PDF

This document describes C operator precedence and associativity. It lists C operators from highest to lowest precedence and whether they associate left-to-right or right-to-left. Parentheses have the highest precedence and associate left-to-right, while assignment operators have the lowest precedence and associate right-to-left.

Uploaded by

kazimir92
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

C Operator Precedence and Associativity

Operator Description Associativity


() Parentheses (function call) (see Note 1) left­to­right
[] Brackets (array subscript)
. Member selection via object name
-> Member selection via pointer
++ -- Postfix increment/decrement
++ -- Prefix increment/decrement right­to­left
+ - Unary plus/minus
! ~ Logical negation/bitwise complement
(type) Cast (change type)
* Dereference
& Address
sizeof   Determine size in bytes
* / % Multiplication/division/modulus left­to­right
+ - Addition/subtraction left­to­right
<< >> Bitwise shift left, Bitwise shift right left­to­right
< <= Relational less than/less than or equal to left­to­right
> >= Relational greater than/greater than or equal to
== != Relational is equal to/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
?: Ternary conditional right­to­left
= Assignment right­to­left
+= -= Addition/subtraction assignment
*= /= Multiplication/division assignment
%= &= Modulus/bitwise AND assignment
^= |= Bitwise exclusive/inclusive OR assignment
<<= >>= Bitwise shift left/right assignment
, Comma (separate expressions) left­to­right

Note 1: Parentheses are also used to group expressions to force a different order of evaluation; 
such parenthetical expressions can be nested and are evaluated from inner to outer.

You might also like