Introduction
Bjarne Stroustrup developed C++ from the C programming language. It added "facilities for better type checking, data abstraction, and object-oriented programming" to C (stroustrup.com).
The ubiquity of C in system programming is because of its zero-overhead principle and its higher level of abstraction than writing in assembly. C++ adheres to these principles as well.
It is now "one of the world's most widely used, high-performance, computer-programming languages" (Deitel et al.).
Sample C++ code
A simple C++ program looks like the following.
#include <cstdio>
int main() {
printf("Hello, world!\n");
return 0;
}
- At the top part of your code, you
#include
(import) the libraries that you want to use. In this case, we includecstdio
that definesprintf()
. - All C++ programs have the
main()
function as its entry point. Your program will start running from this function. - The
main()
function's return value (if you write anyreturn
statement) would denote the exit code of your program; it defaults to 0. (Exit code 0 generally means your program ran succesfully.)
The compiler tool chain
To convert your source code into an executable program, the C++ compiler tool chain (or tool chain) is a collection of these three elements that run one after another:
- The preprocessor — performs basic source code manipulation (e.g. include information about the libraries that you used). For each file processed, it outputs a single translation unit.
- The compiler — reads a translation unit and generates an object file (it contains data and instructions in an intermediate format most people won't understand).

- The linker — reads object files, links them together (along with library codes), and generates a program.
The linker's job (Source: learncpp.com)
References
- C++ Crash Course (Josh Lospinoso) — An Overture to C Programmers
- C++ Crash Course (Josh Lospinoso) — 1. Up and Running
- C++20 for Programmers, 3rd Edition (Harvey Deitel, Paul Deitel) — 1.1 Introduction
- Bjarne Stroustrup's FAQ — https://www.stroustrup.com/bs_faq.html#invention
- 1.5. C++ Compiler Operation — https://icarus.cs.weber.edu/~dab/cs1410/textbook/1.Basics/compiler_op.html
- 0.5 — Introduction to the compiler, linker, and libraries — https://www.learncpp.com/cpp-tutorial/introduction-to-the-compiler-linker-and-libraries/