C++ — Overview
What is C++?
C++ is a general-purpose programming language created by Bjarne Stroustrup, first released in 1985 as an extension of C with object-oriented features (its original name was literally "C with Classes"). C++ is used across game development (Unreal Engine), system software, browser engines (Chrome's V8 has significant C++ components), databases (MySQL's core), high-frequency trading systems, and competitive programming.
C++ Is a Superset of C, With Real Consequences
Almost all valid C code is also valid C++ code, but C++ adds an entire layer on top: classes, references, function overloading, templates, exceptions, and a large standard library (the STL) that C doesn't have. This matters practically in two ways:
malloc/free, raw arrays, and printf — and it will compile. It's just not idiomatic, and you lose the safety and convenience C++ actually offers.malloc/free with new/delete for the same object is undefined behavior, not just bad style.The practical guidance: learn C++'s own idioms (RAII, smart pointers, std::string, STL containers) rather than writing C with class keywords sprinkled in.
C++ Standards
| Standard | Year | Key Addition |
|---|
|---|---|---|
| C++11 | 2011 | Lambda expressions, `auto`, move semantics, smart pointers, threads |
|---|---|---|
| C++14 | 2014 | Generic lambdas, improved constexpr |
| C++17 | 2017 | Structured bindings, if constexpr, |
| C++20 | 2020 | Concepts, coroutines, ranges, modules |
Use C++17 or C++20 for new projects. Most competitive programming judges (Codeforces, CodeChef) default to C++17, so that's the practical standard to learn against if competitive programming is your goal.
Install C++
Hello World
C vs. C++ — Key Practical Differences
The virtual/override pair above is worth flagging even at overview level: virtual on the base class enables runtime polymorphism — calling speak() through a base-class pointer or reference correctly calls Dog::speak(), not Animal::speak(), decided at runtime rather than compile time. This is covered properly in the Fundamentals/Intermediate sections, but it's the mechanism that makes inheritance actually useful rather than just a way to reuse field declarations.
C++ in Competitive Programming
The sync_with_stdio(false) / cin.tie(NULL) pair above is a genuinely common competitive-programming pattern worth understanding, not just copy-pasting: by default, C++'s cin/cout stay synchronized with C's stdio (so you can safely mix printf and cout in the same program), and that synchronization has real overhead. Disabling it speeds up I/O-heavy competitive programs meaningfully, at the cost of no longer being able to safely mix C and C++ I/O in the same program — a tradeoff that's fine for a contest, not something you'd do by default in production code.

