Last Updated:

What a Beginner C++ Developer Should Know?

Programming is a promising area of activity. In order to work competently with the code, you need to know different programming languages. They help to create programs and game content "from scratch" or through specialized engines, libraries.

One of the most popular development languages is C++. It belongs to the SI family. Allows you to create cross-platform applications that are easily ported from one operating system to another. Use C++ if you plan to be fully immersed in development, especially complex utilities or large-scale games.

This article will show you how to write in C++ correctly. Key programming terms, code elements and the main functions implemented in the mentioned language will also be considered.

Advantages and disadvantages

C++ is a cross-platform high-level programming language. It has an object-oriented component. Allows you to create more advanced and complex utilities than other languages of the SI family.

The advantages of it include:

  • the presence of variables of different types;
  • general purpose;
  • static typing;
  • the ability to work with memory;
  • high performance of the final software;
  • availability of its own compiler;
  • work with classes and objects;
  • inheritance;
  • polymorphism;
  • encapsulation;
  • rich libraries to simplify coding;
  • compatibility with C;
  • auto-call object destructors;
  • the presence of operator overload;
  • High availability
  • Templates
  • Support for multiple programming styles.

This is a universal option for the developer. Allows you to create not only applications, but also web utilities, drivers and operating systems.


Despite the fact that C++ is a popular option among programmers, it also has a number of drawbacks:

  • the syntax is clear, but not very well thought out - because of this, beginners have problems when learning;
  • lack of some important features;
  • the presence of operations that, if used incorrectly, lead to the collapse of the entire code;
  • A large amount of summary code.
  • inheritance is carried out with certain difficulties;
  • cumbersome syntax.

Due to the fact that the C++ language uses different types of variables, you will always have to monitor the memory of the device. This is extremely important for large utilities, as well as on low-power devices.

Basic terms

In order to code well in any language, you need to study its "base". And also - well versed in terminology.

At first, the following concepts will come in handy:

  1. A variable (most often int) is a unit of information storage in an application. It is used in a variety of commands.
  2. Object—Related Variables (int). Consts and other structural data. They are selected and processed together. They can have different conditions.
  3. Object-oriented programming is the concept of creating code, which is based on working with objects and data. Logic and action play a secondary role here.
  4. Class—A set of related objects with common properties.
  5. Method is the basic behavior within a class. A set of functions and rules that specify certain manipulations.
  6. An instance variable is a unique set of int (variables).
  7. Operand is an object that can be controlled through operators.
  8. An operator is a function (element) responsible for manipulating operands.
  9. Syntax – Principles and rules regarding operator transmission.
  10. Iteration is a single pass of a utility through a set of functions and operations within the written code.

This is the base on which it is necessary to rely. The corresponding terms are useful not only when programming in C ++, but also in other ways of "communicating" with software and devices.

A few words about the structure

Before you design complex utilities, you need to consider simple examples of codifications. On them - to learn how to code larger projects.

The structure of software in C++ has a clear style. It is understandable, but in large codifications sometimes even an experienced programmer risks getting confused. Here is an example of the code that is responsible for displaying the "Hello World" label:

#include <iostream>
Using mamespace std;

// main() is where program execution begins.
Int main () {
 cout <<"Hello World»:// prints Hello World
return 0;

Here you need to remember the following information:

  1. In C++, you can use multiple headers that contain information. It acts as a necessary or useful utility. To implement the function, you need to set the header <iostream>.
  2. A string that uses the std namespace is needed to tell the compiler to use the appropriate namespace. This is a relatively new feature in C++.
  3. The // main() entry indicates that the program has started running.
  4. A line signed as int main () is the main function. It performs codification.
  5. The following entry is responsible for calling a function that will display the necessary inscription on the screen.
  6. Return 0 – completion of the main() function. The value 0 is then returned. This means that the utility does not return anything. The program will stop performing operations.

This is an example of how the simplest code works in C++. It can serve as a good start for coding.

Compilation and execution


In C++, you can compile into a file that the software then runs. This will require:

  1. Open a text editor and add some code to it. It is worth taking the example given earlier.
  2. Save the file with the name: hello.cpp.
  3. Open the command line and navigate to the directory where the resulting document was saved.
  4. Enter 'g++ hello.cpp' and click on the button responsible for compiling. If the codification has no errors, an a.out file will be generated.
  5. Specify 'a.out'. This is necessary to run the software.

As a result of the described operations, the Hello World inscription will be displayed in a separate window. It is also possible to compile software in C/C++ through the makefile function.


Each way of writing content has its own design standard. If it is observed, it is much easier to read codification, as well as to write large projects.

In C++, a semicolon is a statement terminator. Each "inference" must end with an appropriate symbol. It shows that a certain logical object has ended.


Identifier is a name that is necessary to identify a variable (int or other type), functions, as well as classes, modules, and other custom elements. It is important to remember the following rules:

  • the identifier begins with Latin letters or underscores;
  • You can use numbers from 0 to 9 in a unique name.
  • punctuation marks are not allowed;
  • you cannot put @, %, $characters in identifiers.

The corresponding element is case sensitive. This means that int Marry and int marry are two different unique variables of an integer nature.


A keyword is a part of words reserved in C++. They cannot serve as identifiers. Used to call a variety of functions and operations. Nor can they serve as constants.

C++ Programming

Above is a table of keywords in C++. An example is int. Specifies the type of a variable. If int occurs in program codification, it means that the programmer will work with an element of an integer nature.


A trigraph is a three-character sequence that represents one symbol, as well as a sequence that always contains two question marks at the very beginning.

The trigraph will expand wherever it appears, including literals, processor directives, and comments.

C++ Programming

The most popular trigraph sequences are listed above. In order to save time and effort, it is recommended to avoid the corresponding components. They are not supported by all compilers and can confuse even an experienced developer.


The space also plays an important role in C++. It is included in the standard for the design of program codification. You need to remember the following data:

  1. If the line contains only a space or a space with a comment, it will be called empty.
  2. When the application is running, C++ will skip this string.
  3. The space bar helps to describe tabs, comments, newline characters. Serves to separate one part of the instruction from another.
  4. Gives the compiler the ability to determine where one component in an instruction, such as int, begins, as well as the next component.

Without spaces in the text, the utility will not be able to implement functions and insert comments. The output will be a solid incomprehensible text that the compiler will not be able to process.


A comment is an explanation for the developer. They are needed in order to design the source code as competently and clearly as possible even for beginners.

In the case of C++, it is worth remembering that:

  • there is support for single-line and multi-line comments;
  • characters written inside the comment will be ignored by the compiler;
  • the formatting standard for a comment is /* at the beginning and */ at the end;
  • can start with //.

With the help of the appropriate function, you can "nest" one type of comment into another. For this, the entries /*, */, //are used at the same time.


Data Types

When you need to create codification, various kinds of functionality are used for it. A very important point is the type of data. It is necessary when working with variables. They allocate a certain amount of memory for information.

You can store different types of data:

  • symbol;
  • wide symbol;
  • An integer (int)
  • Boolean values
  • floating-point numbers, and so on.

Based on the type of information, the operating system will begin to allocate memory, and then decide what can and should be stored in reserve.

Built-in primitives

In C++, programmers can take advantage of a variety of built-in data typesets.

Int is an integer that is used in practice more often than others. Some of the above options can be corrected with the help of modifiers:

  • signed;
  • long;
  • short;
  • unsigned.

The table below will tell you how much memory is allocated for each type of information. It also lists the values that the specified "memory cell" accepts.


You can create a new name for an existing information type. This is done using typedef. This is the name of the declaration.

The format will be as follows: typedef type name, where "type" is the specified "variety" and "name" is a unique identifier.

Here's an example that made an integer value named "feet": typedef int feet.

It can now be used in codification. An example is to create an integer indicating the distance: feet distance.


This option is used to concatenate an optional data type name of zero or more identifiers. They can be used as values. Enumerators are constants. To create them, the enum keyword is used.

The above is a general example. If the developer wanted to specify multiple names, they must be separated by a comma.

About the regions

Int and other "data stores" may include:

  • elements within functions or blocks – of a local nature;
  • in defining the parameters of functions – of a formal form;
  • beyond all functions – global.

Each option has its own characteristics and nuances.


Declared inside functions or codification blocks. Used only within the scope of the corresponding operation or command. Outside, the relevant "cells" will act as unknowns.

The above is an example of the corresponding option.


Defined beyond all functions, written on top of the application. Retain value throughout the execution of the software.

The corresponding option can be accessed from any command. It is available for use throughout the code after the declaration. That is why the rules of design include recommendations for setting global variables (int or other kind) at the very top of the codification.

And this is what an application that uses global variables looks like.

A few words about classes

The class is used to determine the scope and lifespan of variables (int and beyond), as well as functions in the resulting utility. There are such storage classes:

  • auto;
  • static;
  • register;
  • extern;
  • mutable.

The first case is to carry by default all local ints (variables). Register is used to store local variables stored in the register. This option will have a maximum size, which is equal to the size of the register (more often - one word).

The case is used for memory cells that require quick access. An example is counters.

Static class

Instructs the compiler to retain a local variable for the duration of the utility. There is no need to create and destroy it. They help maintain values between function calls.

Static also applies to global variations. This will cause the scope of the variable to be confined to the file in which it was declared.

And here's an example of using static in C++.

External class

It provides for the following features:

  • keyword – extern;
  • Helps you point to global "storage locations" that are visible to all application files.
  • The object in use cannot be initialized.
  • the appropriate modifier is applied when the user has two or more files that use the same global operations or "memory cells".

In practice, in simple applications, it is practically not found.


The operator acts as a symbol that will inform the compiler that the necessary mathematical or logical manipulations have been performed. In C++, you may encounter the following variants:

  • arithmetic;
  • relational;
  • logical;
  • assignments;
  • bitwise;
  • Additional.

The first are used for arithmetic operations. The table below will help you navigate the commands you are asking.

About priorities

Priority is the grouping of terms in an expression. Depending on the relevant component, the final result of the "example" will change. Some operators have a higher priority. They are processed by the utility in the first place.

Above is a table that will help you understand the priority of certain code operators in C++. Every programmer should learn it.


An array is a specific data structure that stores a sequential set of fixed-size components of the same type. It is used to store collections of information in the utility.

The following nuances are provided here:

  1. The declaration is made according to the principle of type arrayName [arraySize];.
  2. ArraySize must be an integer constant that is greater than zero.
  3. The type is specified as any provided by the language.

The array is accessed by indexing the array name. This is done by placing the index of the item in square brackets after the name of the "set of information" itself.


When programming, various kinds of conventions are used. They help in the implementation of certain goals:

  • Generate code that has a specific view format. It helps to focus on the content rather than the structure itself.
  • Giving customers a chance to make assumptions based on experience. So it is possible to understand the program code faster.
  • Simplifies the copying, adjustment, and maintenance of the utility.
  • Development of best practices of the SI family.

Here you can see the C++ codification convention.

Quickly merge into a theme

Specialized remote computer courses will help to better understand the inscriptions using namespace std, int, as well as include iostream and others in the C++ language. They allow:

  • quickly master the features of the language;
  • choose a course of narrow or broad specialization, based on the initial level of skills;
  • get invaluable practice;
  • confirm programming and development skills documentarily – at the end of the training, everyone will be issued a certificate in electronic form.

In the process of training, clients will be guided by experienced and educated curators. You can concentrate on one or more directions at the same time.