Introduction to C++
/ 3 min read
Updated:Table of Contents
Why C++?
C++ is powerful because it gives you both speed and control. You can write code that’s close to the hardware but still elegant. Modern C++ is safer and easier, thanks to updates from C++11 to C++20. It’s tough at first, but it’s worth it for what you can build.
Quick look
Skip this if you know or are bored of evolutions.
- C++98:
The first standardized C++ – classes, templates, STL.
- C++03:
Minor bug fixes.
- C++11:
Modern C++ begins – auto, lambdas, move semantics, smart pointers.
- C++14:
Generic lambdas, return type deduction.
- C++17:
Structured bindings, if constexpr, parallel STL.(Compile time programming + Template MetaProgramming).
- C++20:
concepts, ranges, coroutines, modules.
How to Use C++ Without Losing Your Mind
Many developers dislike C++ because:
They expect to learn it in a week (spoiler: it’s not that easy).
The compiler errors don't make any sense sometimes.
Managing memory and avoiding weird bugs (segfaults 🙂 are seriously scary) can be a real headache.
The syntax can get pretty confusing and messy.
There’s no one “official” build system, which makes setup tricky.
How’d you get out of it?
Don’t rush.
Be consistent and use C++ every day.
Don’t be scared of new syntax. Practice it and understand the fundamentals — the why and how behind it.
Once you get a good grip, study open-source projects to see how real-world C++ codebases are structured.
Start by writing basic, working code — even if it’s slow. Then, optimize it using C++ features. Performance comes later.
Stick to modern C++ features — preferably from C++11 and beyond.
What can you build with C++
Literally anything. Examples include
Operating systems
Game Engines
Compilers
Browsers
Embedded Systems
Artificial Intelligence (Yeah, Python devs might cry 😅 — but the core logic and performance-critical libraries are written in C++. Python is often just a wrapper.)
Getting Started
Ughhh 🙁 that’s a bit too theoretical. Let’s look at some actual code.
A Simple "Hello World"
program
#include <iostream>int main(){ std::cout << "Hello World\n"; return 0;}
Installing Clang
First, you need to install the compiler. Throughout this course, we’ll use clang++ because it’s generally faster and produces better diagnostics compared to g++ (GNU).
- For MacOS: Run the following command in your terminal
xcode-select --install
- For Ubuntu/Linux: Run the following command in your terminal
sudo apt updatesudo apt install clang
- For Windows
Download LLVM and add it to Edit System Environments Variable path. Or just use WSL(Windows subsystem for Linux) and follow the same installation steps for Linux. 👉 WSL Installation Guide
Compiling the above code
We’ll start by compiling a single .cc file — no build systems yet.
In your terminal run:
clang++ main.cc -o main
This command compiles main.cc and creates an executable named main. The -o flag stands for “output” — it tells the compiler what to name the executable.
Now run it — and boom, “Hello World” shows up in your terminal! 🎉
I know — we’ve barely touched 1% of what C++ can do. And yeah, even writing “Hello World” might’ve felt a bit annoying or awkward at first (you’re not alone 😅). But stick with me. I’ll be dropping a bunch of posts that’ll make things click, and slowly you’ll start vibing with C++ like a real one.