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

C++ Operator Precedence Guide

This document lists C++ operators in order of precedence from highest to lowest and describes their associativity. It shows that operators with higher precedence are applied before those with lower precedence. It also indicates whether operators of equal precedence are applied from left to right or right to left.

Uploaded by

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

C++ Operator Precedence Guide

This document lists C++ operators in order of precedence from highest to lowest and describes their associativity. It shows that operators with higher precedence are applied before those with lower precedence. It also indicates whether operators of equal precedence are applied from left to right or right to left.

Uploaded by

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

C++ Operator Precedence and Associativity

This page lists C++ operators in order of precedence (highest to lowest). Their associativity
indicates in what order operators of equal precedence in an expression are applied.

Operator Description Associativity


() Parentheses Not applicable
Function call Call to functions left-to-right
[] Array index
. Member selection via object name
-> Member selection via pointer
++ -- Postfix increment/decrement
++ -- Prefix increment/decrement right-to-left
sizeof Determine size in bytes
+ - Unary plus, minus
! Logical negation
& Address
* Dereference/Indirection
(type) Cast (change type)
* / % Multiplication, division, modulus left-to-right
+ - Addition and subtraction left-to-right
< <= Relational less than, less than or equal to left-to-right
> >= Relational greater than, greater than or equal to
== != Equal to, Not equal to left-to-right
&& Logical AND left-to-right
|| Logical OR left-to-right
?: Conditional right-to-left
= Assignment right-to-left
+= -= Addition, subtraction assignment
*= /= Multiplication, division assignment
%= Modulus assignment
, Comma left-to-right

You might also like