Type Casting in C++ — a practical guide to C++ type casting with clear examples you can reuse in real projects.
C++ Tutorial Series (14/111). Prefer one article? Read the complete C++ tutorial.
Short description
Prefer named casts over C-style casts for clarity and safety.
static_cast
double d = 3.7;
int n = static_cast<int>(d); // 3