Questions
C++ questions
Choose a question page, learn the concept, then test your understanding with a quiz.
C++ mutable Keyword Explained: Const Member Functions, Caches, and Mutexes
Learn what the C++ mutable keyword does, why it works with const member functions, and when to use it for caches, mutexes, and internal state.
C++ new Expression: Difference Between `new Test` and `new Test()`
Learn the difference between `new Test` and `new Test()` in C++, including default initialization, value initialization, and class behavior.
C++ nullptr Explained: Why It Is Better Than NULL and 0
Learn what nullptr means in C++11, how std::nullptr_t works, and why nullptr is safer and clearer than NULL or 0.
C++ typedef vs using: Type Aliases Explained
Learn the difference between C++ typedef and using, including type aliases, alias templates, syntax, and when to use each.
C++ volatile Keyword: Purpose, Uses, and Threading Limits
Learn what C++ volatile means, why compilers need it for hardware and signals, and why it is not a replacement for atomics or mutexes.
C++11 Memory Model Explained: Threads, Atomics, and What Changed
Learn what the C++11 memory model is, why it matters for threads and atomics, and how it changed safe concurrent C++ programming.
C++11 Return Statements, Rvalue References, and Move Semantics
Learn how C++11 return statements use NRVO and implicit moves, why returning an rvalue reference to a local is unsafe, and when std::move hurts.
Calling C and C++ from Python: Bindings on Windows
Learn practical ways to call C and C++ libraries from Python on Windows, including ctypes, Cython, pybind11, and choosing the right tool.
Can You Access a Local Variable Outside Its Scope in C++? Dangling Pointers Explained
Learn why returning a pointer to a local variable in C++ is undefined behavior, even when the program seems to work.
Class vs Struct in C++: When to Use Each
Learn the difference between class and struct in C++, when to use each, common conventions, examples, and practical coding guidance.
Const Member Functions and std::set Iterators in C++
Learn why std::set exposes const elements and how const member functions safely fix “discards qualifiers” compiler errors in C++ code.
Constructor Chaining in C++: How Delegating Constructors Work
Learn how constructor chaining works in C++ using delegating constructors, initializer lists, and common patterns for shared setup.
Copy Elision and Return Value Optimization in C++
Learn how C++ copy elision, RVO, and NRVO avoid unnecessary object copies, when they apply, and what changed in C++17.
Copy-and-Swap Idiom in C++: What It Is, Why It Matters, and When to Use It
Learn the copy-and-swap idiom in C++, how assignment works, what problems it solves, and how C++11 move semantics affect it.
Debug C++ Command-Line Arguments in Visual Studio
Learn how to configure command-line arguments in Visual Studio for debugging C++ applications, including argc, argv, quoting, and common fixes.
Debug and Release Builds in CMake with GCC and G++
Learn how to configure Debug and Release builds in CMake, set C and C++ compiler flags safely, and mix GCC C libraries with G++ executables.
Dependent Names, typename, and template in C++ Templates
Learn when and why to use typename and template with dependent names in C++ templates, with clear examples and common pitfalls.
Difference Between `struct Foo` and `typedef struct` in C++
Learn the difference between `struct Foo {}` and `typedef struct {}` in C++, including naming, typedef behavior, and modern best practices.
Difference Between gcc and g++ for C++ Development
Learn the difference between gcc and g++, how they compile C and C++ code, and which compiler command to use for general C++ development.
Enum to String in Modern C++: Standard Options and magic_enum
Learn why C++ enums do not retain names, how to build safe enum-to-string conversions, and when to use constexpr tables or magic_enum.