Types & auto in C++
From the C++ cheat sheet · Variables & Types · verified Jul 2026
Types & auto
Built-in types and type inference.
cpp
// Quick Reference
int i = 42;
double d = 3.14;
bool b = true;
char c = 'A';
auto x = 10; // inferred int💡 auto deduces the type from the initializer - great for verbose iterator types.
⚡ Use the ' digit separator (1'000'000) for readable numeric literals (C++14+).
📌 int/long sizes are platform-dependent; use <cstdint> (int32_t) when width matters.
🟢 char holds a single character in single quotes; "A" is a string literal, not a char.
typesauto