Variables
A saved location in computer memory that we can read or write to is called a variable.
A variable is a component whose value can vary. In a computer program, you can think of a variable as a container, into which you can store some data. In C++, these data containers (variables) have types. You have to use the right type of data container to save your data in your program.
If you want to save an integer, such as 1, 0, or 20, you will use an int
type container. You can use float-type containers to carry around floating-point (decimal) values, such as 38.87, and you can use string variables to carry around strings of letters (think of it as a "string of pearls", where each letter is a pearl).
You can think of your reserved spot in RAM like reserving parking space in a parking garage: once we declare our variable and get a spot for it, no one else (not even other programs running on the same machine) will be given that piece of RAM by the operating system. The RAM beside...