Questions

C++ questions

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

How to Remove an Element from std::vector by Index in C++

Learn how to erase an element from std::vector by index in C++ using erase(), iterators, and safe bounds checks with clear examples.

cppstlstdvectorerase

How to Replace All Occurrences of a Character in std::string in C++

Learn how to replace every occurrence of a character in std::string in C++ using loops, std::replace, and practical examples.

cppalgorithmstr-replacestdstring

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 Split a String by a String Delimiter in C++

Learn how to split strings by a multi-character delimiter in C++ using standard library tools like find and substr.

cppparsingsplittoken

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

How to Use C Arrays in C++: Syntax, Initialization, and Safety

Learn how C-style arrays work in C++: declaration, initialization, indexing, function parameters, multidimensional arrays, and safer alternatives.

cpparrayspointersmultidimensional-array

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.

cpptrigonometry

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

Initialize a Static std::map<int, int> in C++

Learn safe ways to initialize static std::map<int, int> objects in C++, including static members, function-local statics, and C++17 inline variables.

cppstlstdmap

List Exported Symbols in a Linux .so File with nm and readelf

Learn how to inspect exported symbols in Linux shared libraries with nm, readelf, and objdump, and trace symbols back to libraries at link time.

cppcgccsymbols

Makefile vs CMake for C and C++ Builds

Learn the difference between GNU Makefiles and CMake for C/C++ builds, including dependency handling, portability, generators, and practical usage.

cppcmakefilecmake

Multi-Line String Literals in C++: Raw Strings and Concatenation

Learn how to write multi-line C++ string literals with raw strings, adjacent literal concatenation, escaped newlines, and external files.

cppstring-literalsrawstring

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

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.

cppc++11

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

RAII in C++: Resource Acquisition Is Initialization

Learn C++ RAII: how constructors acquire resources and destructors release them safely, with examples, patterns, mistakes, and a mini project.

cppraii

Returning std::unique_ptr Without std::move in C++

Learn why C++ can return a std::unique_ptr without std::move, including implicit moves, return value optimization, and safe ownership transfer.

cppc++11unique-ptrmove-semantics

STL vs C++ Standard Library: The Difference Explained

Learn the historical and practical difference between the STL and the C++ Standard Library, including containers, algorithms, terminology, and usage.

cppstlstdc++-faq

Page 5 of 8 - 158 questions