What is C++?
What is C++?
C++ is a general-purpose, compiled, statically typed programming language. It supports several programming styles: procedural (like C), object-oriented (classes) and generic (templates).
A short history
| Year | Milestone |
|---|---|
| 1979 | Bjarne Stroustrup starts "C with Classes" at Bell Labs |
| 1983 | Renamed C++ (++ is the increment operator: "one step beyond C") |
| 1998 | First ISO standard: C++98 |
| 2011 | C++11: the "modern C++" revolution (auto, lambdas, smart pointers, move semantics) |
| 2014 / 2017 | C++14, C++17 (structured bindings, optional, filesystem) |
| 2020 | C++20: concepts, ranges, modules, coroutines, <=> |
| 2023 | C++23: std::print, std::expected |
A new standard arrives about every 3 years.
C vs C++
| C | C++ |
|---|---|
| Procedural only | Procedural + OOP + generic |
struct holds only data | class holds data and functions |
malloc/free | new/delete, better: smart pointers |
printf/scanf | std::cout/std::cin, std::format, std::print |
| char arrays for text | std::string |
| Write your own lists/maps | STL: vector, map, set, algorithms |
| Error codes | Exceptions (plus error codes) |
Almost all C code is also valid C++, but modern C++ style looks very different.
Where C++ is used
- Games & engines: Unreal Engine, most console games
- Browsers: Chrome, Firefox (parts), Edge
- Finance: high-frequency trading systems
- Databases: MySQL, MongoDB, ClickHouse
- Desktop apps: Adobe Photoshop, Microsoft Office (parts)
- Embedded & robotics, compilers (LLVM), machine-learning engines (TensorFlow, PyTorch cores)
Why learn C++?
- Performance with high-level abstractions ("zero-cost abstractions")
- Deep understanding of memory and how computers work
- Strong demand in games, systems, finance and competitive programming
Key idea: "You don't pay for what you don't use"
C++ features are designed so that if you don't use one, it costs you nothing at runtime.
Example
#include <iostream>
#include <string>
#include <vector>
// A taste of modern C++: a class, a vector and a range-based loop.
class Language {
public:
std::string name;
int year;
};
int main() {
std::vector<Language> family = { {"C", 1972}, {"C++", 1985}, {"Java", 1995}, {"C#", 2000} };
std::cout << "Languages in the C family:\n";
for (const Language& lang : family) {
std::cout << " " << lang.name << " (" << lang.year << ")\n";
}
std::cout << "C++ is " << 2026 - 1985 << " years old in 2026\n";
return 0;
}
/* Output:
Languages in the C family:
C (1972)
C++ (1985)
Java (1995)
C# (2000)
C++ is 41 years old in 2026
*/