Menu Close


C++ Language Overview

C++ is an increment version of C language. It is inspired from Simula and C. It was created as a pre-processor for C to improve productivity of developers. A similar language Objective-C was created in parallel and used by Apple for its operating system.

History of C++

  1. During 1970 Dennis Ritchie created C Programming language.
  2. Bjarne Stroustrup identified that this OOP features can be included in the software development.
  3. C++ Development started in 1979
  4. Versions: Visual C++, Turbo C++, ANSI C++


C++ has influenced creation of a large language family: C#, Java, Swing, GO, Rust, D, JavaScript. All these languages use a similar syntax that is called “curly languages” due to usage of curly brackets {…} for delimitation of code blocks.


Be prepared to enter a world of symbols and weird notations that sometimes are related to math but most of the time are pure innovations. If you can memorize these notations you are half way through. The other half is learning the keywords.


This is the most simple to learn. In C++ we have line comments and block comments. You need comments in a program for two purposes: One is to document the code and second is to comment out some code for debugging purposes. Comments are ignored by the compiler.

Note: The comments use two symbols that are also mathematical operators: / is division and * is multiplication. However the compiler is smart enough to know that two symbols “//” represents comments while a single symbol “/” represents division.

So this was not hard. But if we create a program only with comments it will nod do anything. So first thing we can do is to print something to the console. Next I will present the syntax for this so be prepared for a surprise.

Console Output

In Python we just use function print(“hello”) but in C++ we have the most weird notation possible: “cout” is the “console output” object. << is the output operator and “” is a string. So we feed from from left to right into console.

Note: This symbol << is also bit shift left operator. What it does is not important. It was just a poor choice to use the same symbol for two things that have nothing to do with each other. When you learn C++ you will find this can be confusing, but I will point out the mistakes you have to endure to be able to learn the language properly.


The only way to learn something is to memorize. You can memorize in two ways: The hard way and the easy way. The hard way is to understand first then memorize. The easy way is to memorize first then understand. Both are good.

I will give you a list of C keywords. Do not try to memorize this, just read and observe. Most of the keywords are English words or abbreviations. Once you have master all these keywords you have finished to learn C. These are also good for C++.



There are not many symbols that we can use in C.  These symbols can be used alone or combined in pairs of two. Some symbols are operators, some symbols are used as separators. Together they form language _punctuation_.


Note: For some reason we do not use symbol: @ in C.

If you had the patience to read up to here then is a good sign. It means you really wish to learn C++. Keep reading. I promice there is an adventure waiting for you. At the end of the journey you will be another person. A grown up software developer. A hero with shield and sword.

Program Structure

Now let’s learn some more about a simple C++ program:

This program can be saved as file: hello.cpp. This is the source file of the program. Before you can run this program you have to compile and then you can run the executable file produced by the compiler.

First line: (#include) is a compiler directive. <iostream> is a “header file”. Header files are like a library file. It contains specification of public members. Header file have extension *.h;

Second line: (using namespace) is to allow “std” members to be used without the “std::” member notation (prefix) that is otherwise required for “cout” like this: std::cout;

Third line: Is a comment starting with (//) and ending at the end of the line.

Next line: int main() {…}  declare  the main function. Every C++ program must have a main function that is found by the operating system and executed when we run a program;

Return keyword is used to stop the main function and return a signal (0) to the operating system. This can be also -1 or greater than 0 to signal an error.


Usually each statement in C++ code will terminate with “;”.  Sometimes the statement is long and span several lines. Other times on a single line of code can have multiple statements separated by “;”.

Multiple statements can be contained in a block of code. The block is enclosed with curly brackets {…} that can be nested. There are block statements that have more than one block of code. Each block represents a different path of execution.


A program is created using source files. In the source file we have many statements executed from top to bottom. The program file is divided in invisible regions. These regions are: import region on top, then declaration region then the implementation region.

Learn next: CPP Data Types