What is << symbol in C++?

In C++, the << symbol is an overloaded operator that can be used in two main contexts:

1. Output Stream Operator

When used with the std::cout object, the << operator is called the insertion operator. It is used to output data to the console (standard output).

Example:

int x = 10; std::cout << "The value of x is: " << x << std::endl;
  • In this case, << takes the value of x and "inserts" it into the output stream, displaying it in the console.
  • The output for the above code would be:
    The value of x is: 10
    

2. Bitwise Left Shift Operator

The << operator is also used as the bitwise left shift operator. It shifts the bits of an integer to the left by a specified number of positions, effectively multiplying the number by powers of two.

Example:

int a = 5; // Binary: 0000 0101 int result = a << 1; // Left shift by 1 bit
  • After the left shift, a becomes 0000 1010, which is 10 in decimal.
  • The left shift operator can be used for efficient multiplication by powers of two.

Summary:

  • std::cout <<: Used to print values to the console.
  • << as bitwise operator: Shifts bits to the left, typically used in low-level programming.

Sources:

TAGS
Coding Interview
CONTRIBUTOR
Arslan Ahmad
Arslan Ahmad
ex-FAANG engineering manager and author or Grokking series.
-

GET YOUR FREE

Coding Questions Catalog

Design Gurus Newsletter - Latest from our Blog
Boost your coding skills with our essential coding questions catalog.
Take a step towards a better tech career now!
Explore Answers
Which interview questions to prepare on version control systems like Git?
What are the tips for coding interviews at fintech companies?
What do @classmethod and @staticmethod mean in Python, and how are they different?
What is a remote software engineer?
What is the best skill to get job in Google?
How to undo a Git merge that hasn't been pushed yet?
Related Courses
New
Grokking the AI System Design Interview course cover
Grokking the AI System Design Interview
Learn to design AI systems the way interviewers expect: classic ML products, LLM and RAG architectures, and agentic systems, all through the lens of the system design interview.
4.8
(1,192 learners)
Discounted price for Your Region

$123

Grokking the Coding Interview: Patterns for Coding Questions course cover
Grokking the Coding Interview: Patterns for Coding Questions
The 24 essential patterns behind every coding interview question. Available in Java, Python, JavaScript, C++, C#, and Go. The most comprehensive coding interview course with 543 lessons. A smarter alternative to grinding LeetCode.
4.6
Discounted price for Your Region

$197

Grokking Modern AI Fundamentals course cover
Grokking Modern AI Fundamentals
Master the fundamentals of AI today to lead the tech revolution of tomorrow.
4.1
Discounted price for Your Region

$72

Design Gurus logo
One-Stop Portal For Tech Interviews.
Copyright © 2026 Design Gurus, LLC. All rights reserved.