Summary: An abbreviated precedence chart for C++ operators typically used in a modular structured programming fundamentals course.
Note: You are viewing an old version of this document. The latest version is available here.
An operator is a language-specific syntactical token (one or more symbols) that causes an action to be taken on one or more operands. The following item provides an abbreviated list of those C++ operators that are typically taught in a programming fundamentals course that teaches modular structured programming concepts.
Operators between a set of lines have the same precedence and associativity.
OPERATOR NAME SYMBOL(S) COMMENTS ASSOCIATIVITY
======================================================================
function call () Left to Right
array index []
----------------------------------------------------------------------
postfix increment ++ unary Right to Left
postfix decrement -- unary
----------------------------------------------------------------------
dereference * unary Right to Left
address & unary
unary positive + unary
unary minus - unary
prefix increment ++ unary
prefix decrement -- unary
cast (type) unary
sizeof sizeof (type) unary - compile time
logical NOT ! unary
----------------------------------------------------------------------
multiply * Left to Right
divide /
modulus % remainder
----------------------------------------------------------------------
add + Left to Right
subtract -
----------------------------------------------------------------------
insertion << writing Left to Right
extraction >> reading
----------------------------------------------------------------------
less than < Left to Right
greater than >
less than or equal to <=
greater than or equal to >=
----------------------------------------------------------------------
equality == equal to Left to Right
non-equality != not equal to
----------------------------------------------------------------------
logical AND && Left to Right
----------------------------------------------------------------------
logical OR || Left to Right
----------------------------------------------------------------------
conditional ? : trinary Left to Right
----------------------------------------------------------------------
assignment = Right to Left
addition/assignment +=
subtraction/assignment -=
multiplication/assignment *=
division/assignment /=
modulus/assignment %=
----------------------------------------------------------------------
sequence (or comma) , Left to Right
----------------------------------------------------------------------