C++ is a high-performance, statically-typed, compiled language that extends C with object-oriented, generic, and functional programming paradigms. It powers systems software, game engines, high-frequency trading platforms, and performance-critical applications where direct hardware control and zero-cost abstractions are essential. The language evolves on a three-year cycle β C++20 introduced modules, ranges, concepts, and coroutines; C++23 stabilized them and added std::mdspan, std::print, flat containers, and std::generator; C++26 β finalized in March 2026 β ships static reflection, contracts, std::execution (Senders/Receivers async model), and hardened memory safety, making it the most impactful release since C++11. The key mental model: C++ gives you full control at every layer, but demands you understand the cost of every operation.
What This Cheat Sheet Covers
This topic spans 29 focused tables and 402 indexed concepts, 209 flashcards. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: Fundamental Data Types
C++'s built-in types come with size guarantees that are mostly minimums rather than exact widths, which is why int is "typically" 32-bit and long long is "at least" 64-bit. The richer story here is character types: alongside plain char you get the Unicode-specific char8_t, char16_t, and char32_t, plus utility types like size_t for indexing and nullptr_t for null pointers. C++23 even adds fixed-width floating-point aliases when you need exact bit layouts.
| Type | Example | Description | |
|---|---|---|---|
int x = 42; | β’ Signed integer, typically 32-bit β’ most common integer type for general arithmetic. | ||
long long n = 9223372036854775807LL; | β’ Signed integer, at least 64-bit β’ guaranteed to hold large values across platforms. | ||
float f = 3.14f; | β’ Single-precision 32-bit floating-point β’ lower precision but faster and smaller than double. | ||
double d = 3.14159265359; | β’ Double-precision 64-bit floating-point β’ default for decimal literals and most numerical work. | ||
bool flag = true; | β’ Boolean type holding true or falseβ’ converts to 1 or 0 in integer contexts. | ||
char c = 'A'; | β’ Single 8-bit character β’ typically used for ASCII or narrow strings. | ||
wchar_t wc = L'Ξ©'; | β’ Wide character type, size platform-dependent β’ used for Unicode on Windows or legacy code. | ||
char8_t u8c = u8'β¬'; | β’ UTF-8 character type β’ explicitly represents 8-bit UTF-8 code units. | ||
char16_t u16 = u'β¬'; | β’ UTF-16 character type β’ holds 16-bit Unicode code units. | ||
char32_t u32 = U'π'; | β’ UTF-32 character type β’ holds 32-bit Unicode code points directly. | ||
void func() { } | β’ Represents absence of type β’ used for functions with no return value or generic pointers ( void*). | ||
size_t sz = sizeof(int); | β’ Unsigned integer type from <cstddef>β’ result of sizeof, guaranteed to hold any array index. | ||
std::nullptr_t p = nullptr; | β’ Type of nullptrβ’ distinct from NULL or 0, explicitly represents a null pointer. | ||
std::float32_t f = 1.0f;std::float16_t h = 0.5; | β’ Optional fixed-width floating-point aliases from <stdfloat>β’ std::float16_t, std::float32_t, std::float64_t, std::float128_t, std::bfloat16_t. |