C++
Master performance-critical programming — 67 lessons from C++ basics to advanced systems, game dev, and low-level optimization.
Learn C++ from the basics to advanced — pointers, memory management, the STL, templates and OOP — with clear interactive lessons.
Part of the free C++ course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
C++ gives you full control over the computer. Start with Lesson 1 — we'll guide you through everything step by step.
Lessons in this course
- Introduction to C++ — What C++ is, when to use it, and how to write your first program
- Variables & Data Types — int, float, char, bool — declare and use typed variables in C++
- Data Types — Fundamental types, sizes, signed/unsigned, and modifiers
- Input & Output (cin & cout) — Read and print to the console with iostream
- Strings (std::string) — Create, modify and search strings with std::string
- Type Casting — static_cast and the C++ cast operators
- Enums & enum class — Named constants and the safer scoped enum class
- Namespaces — Organise code and avoid name clashes
- References — Aliases for variables — and why they beat pointers for parameters
- Checkpoint: C++ Basics — Combine I/O, strings and enums in a build challenge — then a quiz
- Vectors (std::vector) — The dynamic array you'll use everywhere
- Maps & Sets — Key-value and unique-value containers from the STL
- Smart Pointers — unique_ptr, shared_ptr, weak_ptr — modern memory safety
- Lambda Expressions — Inline anonymous functions and captures
- auto & decltype — Let the compiler deduce types
- Range-Based for Loops — Iterate containers cleanly with for (auto& x : c)
- Structs (struct vs class) — Group related data — and how structs differ from classes
- Recursion — Functions that call themselves — and the call stack
- const & constexpr — Immutability and compile-time constants
- Checkpoint: Data & Memory — Combine vectors, maps, lambdas and smart pointers — then a quiz
- Operators — Arithmetic, comparison, logical, and bitwise operators explained
- Control Flow — Make decisions with if, else if, else, and switch statements
- Loops — Repeat code with for, while, and do-while loops
- Functions — Write reusable functions with parameters, return types, and overloading
- Arrays & Vectors — Store collections of data with C arrays and the modern std::vector
- Pointers & References — Understand memory addresses, pointers, and reference variables
- Object-Oriented Programming — Create classes with member variables, constructors, and methods
- Inheritance & Polymorphism — Extend classes and override behaviour with virtual functions
- Templates — Write generic functions and classes that work with any type
- STL (Standard Template Library) — Use vector, map, set, algorithms, and iterators from the STL
- Memory Management — Allocate and free memory manually with new/delete and understand RAII
- Move Semantics & Smart Pointers — Use unique_ptr, shared_ptr, and move semantics for safe memory management
- Modern C++ Memory Model & Smart Pointer Internals — The C++ memory model, atomic operations, and smart pointer internals
- Advanced OOP in C++: Virtual Tables, Polymorphic Dispatch & Inheritance Trees — vtables, dynamic dispatch, and multi-level inheritance patterns
- Templates Deep Dive: Type Deduction, Variadic Templates & Fold Expressions — Template argument deduction, variadic templates, and constexpr if
- STL Algorithm Mastery: Transformations, Predicates & Custom Conditions — std::transform, sort, find_if, partition, and custom comparators
- Advanced Containers: vector, list, map, unordered_map, deque Internals — Understand the time/space complexity and internals of each STL container
- Move Semantics, Perfect Forwarding & Rvalue References — Deep dive into &&, std::move, std::forward, and copy elision
- RAII Architecture: Safe Resource Ownership Across Complex Systems — Apply RAII to files, locks, sockets, and other resources safely
- Constexpr & Compile-Time Programming Techniques — Move computation to compile time with constexpr functions and if constexpr
- C++17 & C++20 Modern Features (Structured Bindings, Concepts, Ranges) — Concepts, ranges, structured bindings, std::span, and more
- Operator Overloading Correctly & Safely (Best Practices) — When and how to overload operators without breaking semantics
- Concurrency in C++: Threads, Futures, Promises, async() — Write concurrent C++ with std::thread, std::async, and std::future
- Mutexes, Locks, Deadlock Avoidance & Thread-safe Patterns — std::mutex, lock_guard, unique_lock, and avoiding common deadlock patterns
- Atomic Operations & Low-Level Synchronization — Use std::atomic and memory ordering for lock-free concurrent data
- Memory Allocation Internals: new/delete, allocators & custom allocators — How new/delete work and how to write custom allocators for performance
- Working with Files: Streams, Buffers, Binary I/O & Serialization — Read/write text and binary files with fstream, buffers, and serialization
- Exception Safety Levels (Basic, Strong, No-Throw Guarantees) — Design functions with the basic, strong, and no-throw safety guarantees
- Design Patterns in C++ (Factory, Singleton, Observer, Strategy) — Implement classic GoF patterns idiomatically in modern C++
- Building Modular Applications with Header/Implementation Architecture — Structure large C++ projects with headers, source files, and modules
- The C++ ABI, Name Mangling & Linking Internals — How the ABI affects linking, name mangling, and binary compatibility
- Working with C Libraries: Interoperability & extern "C" — Call C libraries from C++, use extern C, and manage ABI differences
- Advanced Debugging: Valgrind, GDB, ASan, UBSan — Find memory errors, undefined behaviour, and crashes with debug tools
- Profiling & Optimizing C++ Applications (perf, gprof, VTune) — Identify hotspots and apply targeted optimisations with profiling tools
- Understanding Undefined Behavior & How to Avoid It — Common UB traps, how to detect them, and coding practices that prevent them
- Inline Assembly & Low-Level CPU Instructions (Intro) — Write inline assembly for performance-critical sections of C++ code
- C++ Networking (Sockets, Protocol Handling, Async I/O) — Build TCP/UDP servers and clients with POSIX sockets and asio
- Writing High-Performance Code: Cache Lines, Branch Prediction, SIMD — Optimise for CPU cache, branch prediction, and SIMD vectorisation
- Data Structures in C++: Trees, Graphs, Heaps with STL & Custom Code — Implement and use trees, heaps, graphs, and tries in C++
- Building Large-Scale C++ Projects (CMake, Makefiles, Project Layouts) — Configure builds with CMake, manage targets, and structure large projects
- Best Practices for Header Files, Forward Declarations & Dependencies — Manage includes, avoid cyclic dependencies, and keep compile times fast
- C++ Unit Testing (GoogleTest, Catch2, Doctest) — Write unit tests and fixtures with GoogleTest, Catch2, and Doctest
- Building Custom Iterators & Using Ranges Efficiently — Create STL-compatible iterators and use C++20 ranges and views
- Memory Pools, Arenas & Custom Memory Management Techniques — Build arena and pool allocators for fast, predictable memory performance
- Game Development Essentials in C++ (Architecture, Components, Timing) — Entity-component systems, game loops, and timing in C++ game engines
- Creating & Using C++ Libraries (Static, Shared, Cross-Platform) — Build, link, and distribute static and shared C++ libraries cross-platform
- Final Project — Guided project ideas to consolidate your C++ skills in a real codebase
- Concepts & Constrained Templates (C++20) — Constrain templates with concepts and requires for clear, checkable interfaces
- The Ranges Library (C++20) — Compose lazy views and range algorithms with the pipe operator
- Coroutines (C++20) — co_await, co_yield and co_return for lazy generators and async code
- Numerical Computing with Eigen — Matrices, vectors and linear algebra with the header-only Eigen library
- optional, variant & any (C++17) — Type-safe maybe-values, sum types and type-erased values
- string_view & Non-Owning Views — Zero-copy string parameters and the dangling-reference pitfall
- Error Handling with expected (C++23) — Return a value or an error without exceptions, with monadic and_then/transform