Category

Variables and Fundamental Types

Declaring and Initializing Variables

Before using any variable, two things must happen: it is declared (so that the compiler knows the variable’s name and type), and it is initialized (so that the…

Jul 14, 2026 →

Integer Types

There are several integer types available in C++. These types vary by size and by whether they can represent negative numbers. As a beginner, you just need to k…

Jul 14, 2026 →

Floating-Point Types

Floating point types store numbers that contain a fraction of a whole number. Examples include 3.14, negative 0.5, and 0.001. There are two floating point types…

Jul 14, 2026 →

Characters and Boolean Values

C++ has two relatively simple, but perhaps interesting because of their daily usability, types: char (single character) and bool (true and false). Both are ofte…

Jul 14, 2026 →

Signed and Unsigned Types

Signed and Unsigned Types in C++C++ integer types can be signed or unsigned.The difference sets whether or not negative values are permitted and how you go abou…

Jul 14, 2026 →

Fixed-Width Integer Types

The fundamental integer types like int, long, and long long are not guaranteed to have the same sizeof() on different systems. For when you want an integer of e…

Jul 14, 2026 →

Constants with const and constexpr

The typical behavior for a variable in C++ is that its value can be changed; often the value is known at the time it is written and never needs to be changed ag…

Jul 14, 2026 →

Type Inference with auto

You can get tired of explicitly naming your variable’s type for each and every thing. Let the auto keyword guide you and have your compiler determine it for you…

Jul 14, 2026 →

Variable Scope and Shadowing

Each variable exists in a region of the program where the variable name is known. This region is known as its scope. If an inner scope defines a variable with t…

Jul 14, 2026 →
About CppLearn

CppLearn is an interactive, free reference for modern C++. In each lesson, you'll find out how the language works, rather than just lines of code that you can copy and paste. We cover concepts starting from beginner lessons on fundamentals and proceed to templates, move semantics, smart pointers, and areas that usually trap or scare C++ learners.