Variable

A variable is a symbolic name for a memory location in which data can be stored
and subsequently recalled. Variables are used for holding data values so that they
can be utilized in various computations in a program.
All variables have two important attributes:

  • A type which is established when the variable is defined (e.g., integer, real,
    character). Once defined, the type of a C++ variable cannot be changed.
  • A value which can be changed by assigning a new value to the variable. The
    kind of values a variable can assume depends on its type. For example, an
    integer variable can only take integer values

Share this post