Operators in C++ Programming

Part of the C++ for Dummies Cheat Sheet

All operators in C++ perform some defined function. This table shows the operator, precedence (which determines who goes first), cardinality, and associativity in the C++ program.

Operator Cardinality Associativity
Highest precedence () [] -> . unary left to right
! ~ + - ++ — & * (cast) sizeof unary left to right
* / % binary left to right
+ - binary left to right
<< >> binary left to right
< <= > >= binary left to right
== != binary left to right
& binary left to right
^ binary left to right
| binary left to right
&& binary left to right
|| binary left to right
?: ternary right to left
= *= /= %= += -= &= ^= |= <<= >>= binary right to left
Lowest precedence , binary left to right
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com