## Introduction to Integers: C++ Crash Course (Free Tutorial)

Ready to learn one of the most important concepts in C++? No matter what coding language you’re using, integers are one of the most common ways to represent a number. As you an imagine, this is extremely important. By mastering the basics, you will have a firm footing to continue your studies in C++. If you are a beginner and want to learn to code for FREE, check out our 30-minute introductory course here: training.mammothinteractive.com/p/learn-to-code-in-30-minutes

Integers can represent three types of numbers. They can represent positive numbers, negative numbers, and the number zero. However, integers cannot represent decimal numbers and are limited to a certain size.

If you want to test out some coding in real time, hop over to rextester.com. This website will allow you to code in the main window, and test it out instantly.

Right away, you should see a screen with the following code:

````//g++ 4.9.3`

`#include <iostream>`

`int main ()`

`{`
`std:cout << "Hello, world!\n";`
`}````

Lets add in an integer. Underneath `#include <iostream>`, type in the following code:

``int i;``

This is a variable declaration. We’ve created the variable “i”, and we’ve declared it as an integer. This will allow the compiler to allocate memory for it. All objects are lowercase and are typically nouns.

At this point, we haven’t assigned a value to the integer “i”, so it is therefore automatically assigned the value of zero. Let’s add in a bit more code to assign a value. Type in the following so that it looks like this:

``int i =  5;``

Now, the value of integer “i” is five. This is both a variable declaration and an initialization. If we scroll to the bottom of rextester.com and click on “Run It”, we’ll see the compiler print out the number five.

Well done! To learn even more about coding, sign up for our FREE 30-minute introduction course: training.mammothinteractive.com/p/learn-to-code-in-30-minutes.

## Get in Touch.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

### EMAIL US

support@mammothinteractive.com