Questions

C++ questions

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

How to Convert std::string to const char* or char* in C++

Learn how to convert std::string to const char* or char* in C++, when to use c_str() or data(), and how to avoid common mistakes.

cppstringcharstdstring

How to Declare an Interface in C++: Abstract Base Classes Explained

Learn how to create interfaces in C++ using abstract base classes, pure virtual functions, and virtual destructors with clear examples.

cppinheritanceinterfaceabstract-class

How to Implement the Singleton Design Pattern in C++ Correctly

Learn how to implement Singleton in C++ safely, avoid memory leaks, and understand modern alternatives like local static instances.

cppdesign-patternssingleton

How to Iterate Over Words in a String in C++

Learn how to iterate over whitespace-separated words in a C++ string using stringstream, extraction operators, and clean loop patterns.

cppstringsplit

How to Learn C++ from Books: A Beginner-Friendly Guide to Choosing the Right C++ Book

Learn how to choose good C++ books by skill level, avoid bad resources, and build a practical C++ learning path with confidence.

cppc++-faq

How to Profile C++ Code on Linux

Learn how to profile C++ code on Linux to find slow functions, bottlenecks, and performance hotspots using practical examples.

cpplinuxprofiling

How to Sleep for Milliseconds in C++

Learn how to pause a C++ program for milliseconds using modern C++ and POSIX-compatible options with clear examples.

cpplinuxsleep

How to Trim a std::string in C++ Safely

Learn how to trim whitespace from std::string in C++, including safe right-trim, left-trim, edge cases, and common patterns.

cpptrimstdstring

Improving Object Recognition Algorithms in OpenCV with Template Matching and Feature-Based Detection in C++

Learn how to improve OpenCV object recognition in C++ for scale, rotation, noise, occlusion, and false positives using practical techniques.

cppalgorithmimage-processingopencv

New Features in C++17: A Beginner-Friendly Guide

Learn the most important C++17 features, what changed from C++14, and how modern C++ compilers support them in practice.

cppstandardsc++-faqc++17

Pointer vs Reference in C++: What’s the Difference?

Learn the difference between pointers and references in C++ with syntax, examples, mistakes, and practical use cases.

cpppointersreferencec++-faq

Pointers vs Objects in C++: Why Use a Pointer Instead of the Object Itself?

Learn when to use pointers vs objects in C++, how memory and ownership work, and why direct objects are often the better default.

cppc++11pointersc++-faq

Public vs Private vs Protected Inheritance in C++

Learn the difference between public, private, and protected inheritance in C++ with examples, use cases, common mistakes, and comparisons.

cppinheritanceencapsulationaccess-specifier

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.

cppundefined-behaviorc++-faqsequence-points

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.

cppcopy-constructorassignment-operatorc++-faq

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.

cpplinker-errorsundefined-referencec++-faq

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.

cpplanguage-lawyernaming-conventionsc++-faq

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.

cpptypesc++-faq

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.

cpppointersc++11smart-pointers

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.

cppperformancecachingmemory

Page 2 of 4 - 62 questions