Questions
C++ questions
Choose a question page, learn the concept, then test your understanding with a quiz.
Sequence Points and Undefined Behavior in C and C++
Learn what sequence points mean in C and C++, how they relate to undefined behavior, and why expressions like a[++i] = i are unsafe.
Sign Function (Signum) in C and C++: Floats, Zero, and NaN
Learn how to implement a signum function in C and C++ for integers and floats, including correct handling of zero, negative zero, and NaN.
Stack vs Heap Allocation Performance in C++
Learn why automatic stack storage is often faster than heap allocation in C++, what really costs time, and when the difference matters.
Static const std::string Class Members in C++
Learn how to declare and define private static const std::string members in C++, including C++17 inline variables and older standards.
Static vs Dynamic Libraries in C++: When to Use Each
Learn the difference between C++ static and dynamic libraries, how linking and loading work, and when each choice fits a real project.
The Rule of Three in C++: Copying Objects, Copy Constructor, and Copy Assignment
Learn the Rule of Three in C++: what object copying means, when to define copy operations, and how to prevent copying safely.
Typedef Function Pointers in C and C++
Learn how typedef function pointers work in C and C++, why their syntax looks unusual, and how they are used to load DLL functions safely.
Undefined Reference and Unresolved External Symbol Errors in C and C++
Learn what undefined reference and unresolved external symbol errors mean in C and C++, their causes, fixes, and how to prevent them.
Underscores in C++ Identifiers: Rules, Reserved Names, and Safe Naming
Learn when underscores are allowed in C++ identifiers, which names are reserved, and how to choose safe member variable names.
Understanding unsigned char in C and C++
Learn what unsigned char means in C and C++, how it differs from char, and when to use it for bytes, binary data, and numeric values.
Uninitialized bool and Undefined Behavior in C++
Learn why reading an uninitialized bool is undefined behavior in C++, how optimizers use bool assumptions, and how to initialize safely.
Unnamed Namespaces vs Static Functions in C++
Learn why C++ unnamed namespaces are preferred over static functions for internal linkage, file scope, and modern code organization.
What Are POD Types in C++? Plain Old Data Explained
Learn what POD types mean in C++, why they mattered, and how they relate to trivial and standard-layout types with simple examples.
What Are Smart Pointers in C++ and When Should You Use Them?
Learn what smart pointers are in C++, how they manage memory automatically, and when to use unique_ptr, shared_ptr, and weak_ptr.
What Cache-Friendly Code Means and How to Write It
Learn what cache-friendly code means, why memory access patterns matter, and how to write faster, cache-efficient programs.
What Is Move Semantics in C++? A Beginner-Friendly Guide
Learn what move semantics means in C++, why it matters, how move constructors work, and when moving is better than copying.
What Is Object Slicing in C++? Explanation, Examples, and How to Avoid It
Learn what object slicing means in C++, when it happens, why it is dangerous, and how to avoid it with references and pointers.
What Is std::move() in C++ and When Should You Use It?
Learn what std::move() does in C++, how move semantics work, and when to use std::move safely with clear examples and common mistakes.
What T&& Means in C++11: Rvalue References Explained
Learn what T&& means in C++11, how rvalue references work, and why they matter for move semantics and perfect forwarding.
What `const` Means at the End of a Member Function in C++
Learn what `const` after a C++ member function means, how it affects `this`, and when to use const member functions safely.