A Quick guide to C++ Fundamentals – Part 1

In early 1980’s Bjarne Stroustrup working for Bell Labs developed the C++ language. In his own works, “C++ was designed primarily so that my friends and I would not have to program in assembly, C languages. C++ was originally known as C with classes and it’s main purpose was to make wring good programs easier and more pleasant for individual programmers.

Why C ++ ?

  • C++ lay the foundation to more popular modern languages like C# and Java.
  • C++ is still commonly used because :
    • Cross-Platform support
    • Developers have the full control over resources (memory)
    • Support embedded systems (efficiency, security)


C++ is a compiler based language. All the source files needs to be converted to machine language in order to execute. There are few types of compilers you can choose from depending on the features they support. See the list of C++ compilers based on the supported features.

  • A C++ files should end in .cc and header files should end in .h extension.
  • A typical C++ program will consists of at least one header (*.h) file.

Structure of a typical C++ program

Header files

Header files are helpful when there are multiple files which needs to be connected to program.

The main use of the hearer file is to put declarations in a single location which can be imported to other files.

Naming conventions

C++ Naming Conventions
Files (Classes Files / Header Files) :

Filenames including Classes and Heard files should be all lowercase and can include underscores (_) or dashes (-).

Types (Classes / Struct) :

Type names like Classes and Structs should start with a capital letter and have a capital letter for each new word, with no underscores.

class StudentRecord{..}
struct Student{...}
Functions :

Function names should be verbs. When there are multiple words for a function name the first word should begins with lowercase followed by the second word with a capital. (Camel Notation)

function calculateGrades{..}
function validateUser{...}
Variables :

Function names should be verbs. When there are multiple words for a function name the first word should begins with lowercase followed by the second word with a capital. (Camel Notation)

Similar to function names, variables including local variables, instance variables, and class variables are written in lowerCamelCase.

class StudentMarkCalculation{

char studentId[] = "HK3456";

function calculateGrades{
  int studentMarks;
  boolean isStudentPassed;

The main function

The main function acts as the starting point of the execution and it is mandatory in a C++ program.

#include <iostream>

int main() {
    return 0;

The namespaces

In C++ language we can logically divide our code into namespaces. The main advantage of using namespaces is to avoid name collisions.

using std namespace

The std namespace is used when we want to use any of the standard C++ library types and functions like cout or cin.

#include <iostream>

// The std namespace needs to be declared.
using namespace std;

int main() {
    cout << "Cyber Memos!";
    return 0;

That is a quick overview of how C++ language is structured. Read the next lesson on C++ data types.

Download the Code.

NEXT >> C++ Data Types – Part 2

Cite this article as: Guest Contributor, "A Quick guide to C++ Fundamentals – Part 1," in Cyber Memos, March 8, 2020, https://cybermemos.com/developent/quick-guide-to-c-fundamentals-part-1/.

2 Replies to “A Quick guide to C++ Fundamentals – Part 1”

  1. Sun Li

    Thank you for the clean article. I’m getting issues with definign pointers to reference types:

    int* i =20;
    cout<< &i;

    Can you please explain. Thanks.

  2. Sam Muller

    Hi Sun,

    Thank you for the msg.

    Please see the below explanation on the two statements you are trying to execute:

    int* i =20;
    // the ‘*’ means this is a Deference operator which will ONLY operates on a pointer variable. So if you want to Point to a int variable that is already declared.

    int i = 20;
    int* pointerTOi = &i;
    cout<< pointerTOi; // This will print the memory address for the i. We will be covering pointers in a new and quick post. Will keep you informed.

Leave a Reply

Your email address will not be published. Required fields are marked *