Questions

C++ questions

Choose a question page, learn the concept, then test your understanding with a quiz.

Advantages of Brace Initialization in C++

Learn why C++ brace initialization is often clearer and safer than other object initialization styles, with examples and common pitfalls.

cppc++11syntaxinitialization

Basic Rules and Idioms for Operator Overloading in C++

Learn the core rules, syntax, and common idioms for operator overloading in C++, including member vs non-member operators.

cppoperatorsoperator-overloadingc++-faq

C++ Aggregates, Trivial Types, Trivially Copyable Types, and PODs Explained

Learn what aggregates, trivial types, trivially copyable types, and PODs mean in C++, how they differ, and why they matter.

cppc++11aggregatec++17

C++ Base Class Constructor Rules Explained

Learn how C++ base class constructors are called from derived classes, including order, syntax, defaults, and common mistakes.

cppinheritanceconstructor

C++ Casts Explained: C-Style Cast vs static_cast vs dynamic_cast

Learn the difference between C-style casts, static_cast, and dynamic_cast in C++ with clear examples, safety rules, and real usage tips.

cpppointerscasting

C++ File Extensions Explained: .cc vs .cpp on Linux

Learn the difference between .cc and .cpp in C++, when to use each, and how teams choose file extensions on Linux projects.

cppfilenames

C++ Functors Explained: What They Are and When to Use Them

Learn what C++ functors are, how operator() works, and when function objects are useful in STL algorithms and real codebases.

cppfunctorfunction-objectfunction-call-operator

C++ Fundamental Type Sizes: What the Standard Guarantees About int, long, char, float, and double

Learn what the C++ standard guarantees about fundamental type sizes, including int, long, char, float, and double across platforms.

cppintegerlanguage-lawyerlong-integer

C++ Header File Extensions: .h vs .hpp Explained

Learn the difference between .h and .hpp in C++, when each is used, and how teams choose a header naming convention in real codebases.

cppheadernaming-conventionsfile-type

C++ Lambda Expressions Explained: What They Are and When to Use Them

Learn what C++ lambda expressions are, why they exist, when to use them, and how they simplify callbacks, algorithms, and local logic.

cpplambdac++11c++-faq

C++ Template Definitions in .cpp Files: Explicit Instantiation Explained

Learn when C++ template definitions can live in .cpp files, how explicit instantiation works, and how portable it is across compilers.

cpptemplates

C++ Value Categories Explained: lvalues, rvalues, xvalues, glvalues, and prvalues

Learn C++ value categories clearly: lvalues, rvalues, xvalues, glvalues, and prvalues, with examples and why C++11 introduced them.

cppc++11expressionc++-faq

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.

cppclasskeywordmutable

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.

cppconstructorinitializationnew-operator

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.

cpppointersc++11nullptr

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.

cppc++11typedefusing-declaration

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.

cppmultithreadingc++11language-lawyer

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.

cppmemory-managementlocal-variablesdangling-pointer

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.

cppoopclassstruct

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.

cppconstructordelegates

Page 1 of 6 - 110 questions

PreviousNext