Operators and Punctuators

Operators and Punctuators

Arithmetic, comparison, logical, bitwise, access, cast, and punctuation tokens across C and C++.

How to use this reference page

Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.

  • Scan the top of the page first to identify the primary types, functions, or algorithm families involved.
  • Use the nearby-page links when your question is really about a companion header, related algorithm family, or broader subsystem.
  • Validate tricky behavior with a small compileable example before relying on memory for details like invalidation, ordering, allocation, or lifetime rules.

Operators and Punctuators

Arithmetic operators

Comparison operators

Logical operators

Bitwise operators

Assignment operators

Access and call operators

Control-oriented tokens

Punctuation and separators

Operator overloading in C++

C++ allows many operators to be overloaded, including:

Not overloadable include:

Practical guidance

Example in practice

int main() {
    int total = 0;
    for (int i = 0; i < 4; ++i) {
        total += i;
    }

    return total == 6 ? 0 : 1;
}