Here I will cover a couple of the concepts we will be using a lot throughout this guide, if you already consider yourself a master at C++, feel free to continue to the next page of the guide.


Table of Contents:


Syntax


In C++, the syntax is very similar to other C-Style languages, such as C#, Java, and JavaScript. However, unlike most of those languages, C++ is very low-level, meaning there isn’t a lot it does for you. Take this hello world program for example:

#include <iostream>

int main() {
	std::cout << "Hello World!" << "\\n";
}

In the block above is a statement that prints Hello World! on build. The first line is #include <iostream>, a include is a statement similar to python’s import statement, if you use <...> on the include, it will import a module from the standard library, if you want to import your own header (.h) or code (.cpp) files, you must use quotations instead.

In the second line, it says int main() { , this is a function definition, the syntax for that is similar to other languages where it is <return type> FuncName(<arg type> arg, ...) { }.

lastly there is std::cout, cout is part of the standard library, and is the iostream that goes to the console, shifting contents into this iostream effectively is a print statement.

Pointers


What is a pointer?

int A = 14; //regular integer

int* APointer = &A; //creating a pointer

A pointer is a variable that points to the memory address of a different variable. The asterisk represents the fact that that variable is a pointer towards that type, and the ampersand (&) is an operator that gives the memory address of a variable.