Questions
C++ questions
Choose a question page, learn the concept, then test your understanding with a quiz.
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.
How to Use Pi and Trigonometric Functions in C++
Learn how to use Pi in C++ with trigonometric functions, what headers to include, and modern ways to access mathematical constants safely.
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.
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.
Pass by Value vs const std::string& in Modern C++
Learn when to pass std::string by value or const reference in modern C++, and how move semantics change function parameter design.
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.
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.
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.
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.
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.
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.
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.