- Variables are generally used to hold the result of computations.
They can hold numbers, fractions, letters, etc.
- A simple variable can only hold one value at a given time.
The next time you modify it, the old value is gone, replaced by the new one.
- In C/C++, each variable has a type. Variable type
determines what kind of data can be stored into the variable. For example:
Integer variables may only store integer values.
- Let's look at the following example:
|