Questions

C++ questions

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

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++ 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++ 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++ 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++ 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++ 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++ 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

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.

cppcopy-constructorassignment-operatorc++-faq

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.

cpptemplatestypenamec++-faq

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.

cppstructtypedef

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.

cppgccg++

Handling Cycles in Family Tree Graphs in C++ and Qt

Learn how to model and process cycles in family tree software using C++ and Qt without breaking assertions or graph logic.

cppgraphcycleassertions

How to Concatenate Two std::vector Objects in C++

Learn how to concatenate two std::vector objects in C++ using insert, loops, and move iterators with clear examples and common pitfalls.

cppconcatenationstdstdvector

How to Convert int to String in C++

Learn how to convert int to string in C++ using std::to_string, stringstream, and older approaches with clear examples.

cppstringtype-conversioninteger

How to Convert std::string to Lowercase in C++

Learn how to safely convert std::string to lowercase in C++ using std::tolower, loops, and transform, with pitfalls and examples.

cppstringstdtolower

Page 1 of 4 - 62 questions

PreviousNext