A variable serves two purposes. It provides you with a way of referring to particular information, and also reserves the amount of memory necessary to store that information.
You must create a variable before you can start using it. You create a variable by declaring it. You may declare multiple variables of the same type in one statement.
You can use the address operator, &, to determine the address of a variable, and the sizeof operator to determine the size of a variable.
The purpose of a variable is to store information. Therefore, after you have created a variable, the next logical step is to specify the information that the variable will store. This is called assigning a value to a variable.
A variable can be assigned a value either by the programmer in code or by the user, usually via the keyboard, when the program is running. You use the assignment operator to assign a value supplied by code. You use the cin object to assign a value supplied by the user .
In the next chapter, you will learn how to use variables to perform arithmetic.