Skip to content

Chapter 1 of 31

Introduction to C++

Trace C++ history, install a modern toolchain, and compare C with modern C++.

24 minutes 10 quick checksBy Subha Prasad
Lesson 1 of 31Course navigation

Lesson content

Read, practise, then check your understanding

C++ began as Bjarne Stroustrup’s “C with Classes” at Bell Labs in 1979 and became C++ in 1983. ISO standardization started with C++98 and evolved through C++11, C++14, C++17, C++20, and C++23. Modern C++ supports procedural, object-oriented, generic, and functional styles while retaining efficient access to hardware.

Toolchain and first build

Install GCC, Clang, or MSVC and use a recent language mode. Enable warnings because they catch many type, lifetime, and control-flow mistakes.

#include <iostream>

int main() {
    std::cout << "Hello, modern C++!\n";
}

With GCC or Clang, build with c++ -std=c++20 -Wall -Wextra -Wpedantic main.cpp -o app. A project normally moves through preprocessing, compilation, assembly, and linking. Debuggers, sanitizers, formatters, and a build system such as CMake complete the practical setup.

C and C++ are different languages

C++ inherited much of C syntax, but idiomatic C++ uses constructors, destructors, references, templates, exceptions, containers, algorithms, and RAII. Prefer std::string to manual character buffers, std::vector to owning dynamic arrays, and smart pointers to owning raw pointers. C-style casts, malloc, and global mutable state may compile but bypass useful C++ guarantees.

The zero-overhead goal

C++ abstractions are designed so unused features cost nothing and well-designed abstractions can compile to code comparable with a manual implementation. Performance is not automatic: undefined behavior, needless allocation, poor data layout, and accidental copies still matter. Start with clear ownership and strong types, test behavior, then profile before optimizing.

Knowledge check

Answer every question correctly to complete this chapter.

Who began developing C++?
Which feature most clearly distinguishes C++ from C?
Which option requests C++20 in GCC or Clang?
What does RAII connect to object lifetime?
What file extension commonly identifies C++ source?
Which organization standardizes C++?
What source language preceded the name C++?
Which stage resolves external function definitions?
Why is C++ called multi-paradigm?
What should a debug build enable?

0 of 10 checks passed

Your progress is saved on this device.

Introduction to C++ | C++ Lesson | Subha Prasad