Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
A variable is something to store data in. This data can be of any data type. The name of the variable is called its identifier.
Don't declare a variable until you have a value to initialize it with [1].
In the code example below, there are two variables, 'number' and 'i':
#include <iostream> |
This produces the following screen output:
0 : 0 |
The scope of the variable 'number' is from the line it is declared to the end of main.
The scope of the variable 'i' is inside the for-loop.
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.