Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • C++ Data Types
  • C++ Input/Output
  • C++ Arrays
  • C++ Pointers
  • C++ OOPs
  • C++ STL
  • C++ Interview Questions
  • C++ Programs
  • C++ Cheatsheet
  • C++ MCQ
  • C++ Projects
  • C++ Exception Handling
  • C++ Memory Management
Open In App
Next Article:
Setting up C++ Development Environment
Next article icon

C++ Tutorial | Learn C++ Programming

Last Updated : 18 Mar, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

C++ is a popular programming language that was developed as an extension of the C programming language to include OOPs programming paradigm. Since then, it has become foundation of many modern technologies like game engines, web browsers, operating systems, financial systems, etc.

features-of-cpp

Features of C++

Why Learn C++?

C++ is often taught as a foundational language to aspiring programmers, but it is much more than that:

  • C++ remains one of the most used and popular programming languages used in making operating systems, embedded systems, graphical user interfaces and nowadays in High Frequency Trading (HFT) software.
  • It supports both low-level and high-level features such as manual memory management and OOPs programming respectively.
  • Syntax similarity with C, Java, and C# makes it easier to switch languages.
  • C++ provides one of the fastest execution speeds among high level languages, which can be a deciding factor in Competitive Programming or high-performance applications.

C++ Tutorial

This C++ tutorial provides a comprehensive guide to learn C++ in a well-organized, step-by-step manner. It is suitable for both absolute beginners and seasoned programmers seeking to deepen their knowledge. Each topic in this tutorial is clearly explained with practical code examples and real-world applications.

First C++ Program

Before going in-depth with this C++ tutorial, let’s have a quick intro to C++ language using a simple program that prints the text “Hello World”. You can run this program by clicking on the play button on the top right of the code snippet.

C++
#include <iostream> using namespace std; int main() {   cout << "Hello World!";   return 0; } 

Output
Hello World!

Let’s start now!

C++ Overview

  • Introduction to C++
  • Features
  • History
  • Interesting Facts
  • Setting Up C++ Development Environment

C++ Basics

  • Hello World Program
  • Comments
  • Tokens
  • Identifiers
  • Keywords
  • Variables
  • Data Types
  • Literals
  • Constants
  • Operators
  • Input and Output

C++ Control Flow

  • if Statement
  • if-else Statement
  • if-else-if Ladder
  • Nested if-else Statement
  • Switch Statement
  • Jump Statements
  • for Loop
  • while Loop
  • do…while Loop

C++ Functions

  • Functions
  • Parameter Passing
  • Default Arguments
  • Recursion
  • Inline Functions

C++ Pointers

  • Introduction to Pointers
  • Applications of Pointers
  • Pointer Arithmetic
  • Dangling, Void, Null, and Wild Pointers
  • References
  • Pointers vs References

C++ Arrays

  • Introduction to Arrays
  • Pointer to an Array
  • Passing Arrays to Functions
  • Size of Array
  • Multidimensional Arrays

C++ Strings

  • Introduction to Strings
  • Array of Strings
  • String Functions
  • String Concatenation
  • Substring

C++ Structures and Unions

  • Introduction to Structures
  • Pointer to Structure
  • C Structures vs C++ Structures
  • Introduction to Unions
  • Bit Fields
  • Enumeration
  • typedef

C++ Dynamic Memory

  • Dynamic Memory Management
  • new and delete Operators
  • new vs malloc() and free() vs delete
  • Memory Leak
  • Static vs Dynamic Memory Allocation

C++ OOPS Concepts

  • Classes and Objects
  • Access Modifiers
  • Friend Class and Function
  • Constructors
  • Destructors
  • Shallow Copy and Deep Copy
  • this pointer
  • Encapsulation
  • Abstraction
  • Polymorphism
  • Function Overloading
  • Function Overriding
  • Inheritance
  • Multiple Inheritance
  • Virtual Functions

C++ Exception Handling

  • Exception Handling
  • Exception Handling using Classes
  • Stack Unwinding 
  • User-Defined Exceptions

C++ Files and Streams

  • Files and Streams
  • I/O Redirection

C++ Templates

  • Templates
  • Template Specialization
  • using Keyword

C++ STL

  • The C++ Standard Template Library (STL)
  • Algorithms
  • Containers
  • Iterators
  • STL Vector
  • STL Pair
  • STL Set
  • STL Multiset
  • STL Stack
  • STL Queue
  • STL Priority Queue
  • STL Deque
  • STL List
  • STL Forward List
  • STL Map
  • STL Multimap
  • STL Bitset
  • STL Unordered Set
  • STL Unordered Map
  • STL Unordered Multiset
  • STL Unordered Multimap

C++ Preprocessors

  • Preprocessor
  • Preprocessor Directives
  • #include Directive
  • #define Directive
  • Conditional Preprocessors

Advanced C++

  • Namespaces
  • Multithreading
  • Smart Pointers
  • Function Callbacks
  • Signal Handling
  • Generics

C++ Interview Questions

  • Top 50 C++ Interview Questions and Answers
  • Top C++ STL Interview Questions and Answers
  • 30 OOPs Interview Questions and Answers
  • Top C++ Exception Handling Interview Questions and Answers

Difference Between C and C++

FeatureCC++
TypeProcedural Programming LanguageMiddle-level Language that supports both Procedural and Object-Oriented Programming (OOP)
ParadigmProcedural onlyMulti-paradigm: Supports Procedural, Object-Oriented, and Generic Programming
Data SecurityLess secure as it supports only procedural programmingMore secure due to features like encapsulation, which hides data
Use of Classes and ObjectsDoes not support classes and objectsSupports classes and objects, enabling Object-Oriented Programming
Memory ManagementManual memory management using functions like malloc and freeSupports both manual (using malloc/free) and automatic memory management (using constructors/destructors and new/delete keywords)
Function OverloadingDoes not support function overloadingSupports function overloading, allowing multiple functions with the same name but different parameters
Exception HandlingDoes not support exception handlingSupports exception handling using try, catch, and throw keywords
NamespaceNo namespace featureSupports namespaces to avoid name collisions
Input/Output FunctionsUses standard input/output functions like scanf and printfUses object-oriented input/output streams like cin and cout
InheritanceNo support for inheritanceSupports inheritance, allowing classes to inherit properties and methods from other classes
Template SupportNo support for templatesSupports templates, enabling generic programming
Dynamic BindingDoes not support dynamic bindingSupports dynamic binding using virtual functions
Header File ExtensionsUses .h file extension for header filesUses .hpp or .h file extensions for header files
CompatibilityGenerally limited to C programmingBackward compatible with C, allowing C code to run in C++ programs
Application DomainMainly used for system programming, embedded systems, and low-level programmingWidely used in game development, GUI applications, real-time simulations, and system/software development

Learn C++ Interactively

If you feel overwhelmed and looking for a simpler guide to learn C++, then you can explore GFG Free C++ Programming Language Guide. It is simple guide which discuss the basic components of the language first and provide quizzes and practice questions after each concept to help you master it. It also contains final assessment tests at the end of the tutorial.

Jobs or Careers in C++

If we see the Statista report, then you will see that after Java and C#, C++ will be one of the most used programming languages in 2023. In the list of the most used languages, 22.42% of developers use this language. There are multiple companies seeking proficient C++ developers; some of them are listed below:

  • BOSCH Group
  • Capgemini
  • Amazon
  • Microsoft 
  • Accenture
  • IBM
  • Meta
  • Adobe
  • Apple
  • Mozilla
  • Wipro 
  • Infosys 


Next Article
Setting up C++ Development Environment
author
kartik
Improve
Article Tags :
  • C++
  • Tutorials
Practice Tags :
  • CPP

Similar Reads

  • C++ Tutorial | Learn C++ Programming
    C++ is a popular programming language that was developed as an extension of the C programming language to include OOPs programming paradigm. Since then, it has become foundation of many modern technologies like game engines, web browsers, operating systems, financial systems, etc. Why Learn C++?C++
    5 min read
  • Setting up C++ Development Environment
    C++ is a general-purpose programming language and is widely used nowadays for competitive programming. It has imperative, object-oriented, and generic programming features. C++ runs on lots of platforms like Windows, Linux, Unix, Mac, etc. Before we start programming with C++. We will need an enviro
    8 min read
  • Writing First C++ Program - Hello World Example
    The "Hello World" program is the first step towards learning any programming language and is also one of the most straightforward programs you will learn. It is the basic program that demonstrates the working of the coding process. All you have to do is display the message "Hello World" on the outpu
    4 min read
  • C++ Variables
    In C++, variable is a name given to a memory location. It is the basic unit of storage in a program. The value stored in a variable can be accessed or changed during program execution. Creating a VariableCreating a variable and giving it a name is called variable definition (sometimes called variabl
    5 min read
  • C++ Data Types
    Data types specify the type of data that a variable can store. Whenever a variable is defined in C++, the compiler allocates some memory for that variable based on the data type with which it is declared as every data type requires a different amount of memory. C++ supports a wide variety of data ty
    8 min read
  • Operators in C++
    C++ operators are the symbols that operate on values to perform specific mathematical or logical computations on given values. They are the foundation of any programming language. Example: [GFGTABS] C++ //Driver Code Starts{ #include <iostream> using namespace std; int main() { //Driver Code E
    10 min read
  • Basic Input / Output in C++
    In C++, input and output are performed in the form of a sequence of bytes or more commonly known as streams. Input Stream: If the direction of flow of bytes is from the device (for example, Keyboard) to the main memory then this process is called input.Output Stream: If the direction of flow of byte
    5 min read
  • Decision Making in C++

    • Decision Making in C (if , if..else, Nested if, if-else-if )
      In C, programs can choose which part of the code to execute based on some condition. This ability is called decision making and the statements used for it are called conditional statements. These statements evaluate one or more conditions and make the decision whether to execute a block of code or n
      8 min read

    • C++ if Statement
      The C++ if statement is the most simple decision-making statement. It is used to decide whether a certain statement or block of statements will be executed or not executed based on a certain condition. Let's take a look at an example: [GFGTABS] C++ #include <iostream> using namespace std; int
      3 min read

    • C++ if else Statement
      The if statement alone tells us that if a condition is true it will execute a block of statements and if the condition is false, it won’t. But what if we want to do something else if the condition is false. Here comes the C++ if else statement. We can use the else statement with if statement to exec
      4 min read

    • C++ if else if Ladder
      In C++, the if-else-if ladder helps the user decide from among multiple options. The C++ if statements are executed from the top down. As soon as one of the conditions controlling the if is true, the statement associated with that if is executed, and the rest of the C++ else-if ladder is bypassed. I
      3 min read

    • C++ Nested if-else Statement
      Nested if-else statements are those statements in which there is an if statement inside another if else. We use nested if-else statements when we want to implement multilayer conditions (condition inside the condition inside the condition and so on). C++ allows any number of nesting levels. Let's ta
      3 min read

    • Switch Statement in C++
      In C++, the switch statement is a flow control statement that is used to execute the different blocks of statements based on the value of the given expression. It is an alternative to the long if-else-if ladder which provides an easy way to execute different parts of code based on the value of the e
      6 min read

    • Jump statements in C++
      Jump statements are used to manipulate the flow of the program if some conditions are met. It is used to terminate or continue the loop inside a program or to stop the execution of a function. In C++, there is four jump statement: Table of Content continue Statementbreak Statementreturn Statementgot
      4 min read

    C++ Loops

    • C++ Loops
      In C++ programming, sometimes there is a need to perform some operation more than once or (say) n number of times. For example, suppose we want to print "Hello World" 5 times. Manually, we have to write cout for the C++ statement 5 times as shown. [GFGTABS] C++ #include <iostream> using namesp
      8 min read

    • for Loop in C++
      In C++, for loop is an entry-controlled loop that is used to execute a block of code repeatedly for the given number of times. It is generally preferred over while and do-while loops in case the number of iterations is known beforehand. Let's take a look at an example: [GFGTABS] C++ #include <bit
      6 min read

    • C++ While Loop
      In C++, the while loop is an entry-controlled loop that repeatedly executes a block of code as long as the given condition remains true. Unlike the for loop, while loop is used in situations where we do not know the exact number of iterations of the loop beforehand as the loop execution is terminate
      3 min read

    • C++ do while Loop
      In C++, the do-while loop is an exit-controlled loop that repeatedly executes a block of code at least once and continues executing as long as a given condition remains true. Unlike the while loop, the do-while loop guarantees that the loop body will execute at least once, regardless of whether the
      4 min read

    • Range-Based for Loop in C++
      In C++, the range-based for loop introduced in C++ 11 is a version of for loop that is able to iterate over a range. This range can be anything that is iteratable, such as arrays, strings and STL containers. It provides a more readable and concise syntax compared to traditional for loops. Let's take
      3 min read

  • Functions in C++
    A function is a building block of C++ programs that contains a set of statements which are executed when the functions is called. It can take some input data, performs the given task, and return some result. A function can be called from anywhere in the program and any number of times increasing the
    9 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences