Friday, September 25, 2009

online learn c++ variable

1 Variables
1.1 Declarations
Computers must store data in memory. You access the memory by assigning it a name as a variable, for example:
int x;
This allocates memory for an integer variable called x. You can write to the memory by assigning a value to x:
x = 6;
All variables must be declared before they are used. This means telling the compiler what type of data a variable represents. The syntax of a declaration is:
;Where type is the type of the new variable, and identifier is the name. In the previous example, ‘int’ is the type, and ‘x’ is the identifier