Operators in C and C Plus Plus

The title of this article is incorrect because of technical limitations. The correct title is Operators in C and C++.

This is a list of operators in C++ programming language. Third column tells whether or not the operator in question also exists in C99 (and also in C89, since the two versions of the C language contain the same set of operators).

The following operators are sequence points in all three languages: &&, ||, ?:, and ,

C++ also contains the type conversion operators const_cast, static_cast, dynamic_cast, and reinterpret_cast which are not listed in the table for brevity.

Contents

Arithmetic Operators

Operator Name Syntax Is overloadable? In C99?
Plus Operator (unary) +a Yes. Yes.
Addition Operator a + b Yes. Yes.
Addition Prefix Operator ++a Yes. Yes.
Addition Postfix Operator a++ Yes. Yes.
Addition Assignment Operator a += b Yes. Yes.
Negation Operator (unary) -a Yes. Yes.
Subtraction Operator a - b Yes. Yes.
Subtraction Prefix Operator --a Yes. Yes.
Subtraction Postfix Operator a-- Yes. Yes.
Subtraction Assignment Operator a -= b Yes. Yes.
Multiplication Operator a * b Yes. Yes.
Multiplication Assignment Operator a *= b Yes. Yes.
Division Operator a / b Yes. Yes.
Division Assignment Operator a /= b Yes. Yes.
Modulus Operator a % b Yes. Yes.
Modulus Assignment Operator a %= b Yes. Yes

Comparison Operators

Operator Name Syntax Is overloadable? In C99?
Less Than Operator a < b Yes. Yes.
Less Than Or Equal To Operator a <= b Yes. Yes.
Greater Than Operator a > b Yes. Yes.
Greater Than Or Equal To Operator a >= b Yes. Yes.
Not Equal To Operator a != b Yes. Yes.
Equal To Operator a == b Yes. Yes.
Negation Operator !a Yes. Yes.
Logical And a && b Yes. Yes.
Logical Or a || b Yes. Yes.

Bitshift Operators

Operator Name Syntax Is overloadable? In C99?
Left Shift a << b Yes. Yes.
Left Shift + Assignment a <<= b Yes. Yes.
Right Shift a >> b Yes. Yes.
Right Shift + Assignment a >>= b Yes. Yes.

Bitwise Operators

Operator Name Syntax Is overloadable? In C99?
Bitwise Complement ~a Yes. Yes.
Bitwise And a & b Yes. Yes.
Bitwise And + Assignment a &= b Yes. Yes.
Bitwise Or a | b Yes. Yes.
Bitwise Or + Assignment a |= b Yes. Yes.
Bitwise Xor a ^ b Yes. Yes.

Other Operators

Operator Name Syntax Is overloadable? In C99?
Assignment Operator a = b Yes. Yes.
Function Call Operator a() Yes. Yes.
Array Operator a[] Yes. Yes.
Dereference Operator *a Yes. Yes.
Arrow Operator a-> Yes. Yes.
Member Operator a.b No. Yes.
Cast Operator (type)a Yes. Yes.
Comma Operator a , b Yes. Yes.
Conditional a ? b : c No. Yes.
Scope Resolution a :: b No. No.
Sizeof Operator sizeof a No. Yes.
Type Identification Operator typeid (type) No. No.

Notes

Some of the functions listed above are sometimes given longer form "names". For example, += and -= are often called PlusEqual and MinusEqual. This is also useful in performing internet searches, as major sites like google do not allow a search for "+=" for example.

Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools