- Variables store values which must be declared before they can be used, and they must have a data type (int,float, char for example).
- C++ is strongly typed and the basic data types that it recognizes are:
This is how the variables are represented in code:
int number = 10; //initialises the number variable with the value 10
int anotherNumber = 15; //initialises the anotherNumber variable with the value 15
float aFloat = 0.7;
char aChar = ‘a’;
int number = 10; //initialises the number variable with the value 10
int anotherNumber = 15; //initialises the anotherNumber variable with the value 15
float aFloat = 0.7;
char aChar = ‘a’;