Variable is an identifier. It is the most fundamental aspect of any computer language. It is a location I memory whose content can change. It is given a symbolic name for easy reference. To understand this concept, let us have a look at the following statements. 

    •   total =500.25 ;
    •  net = total -100;

In statement number (1) a value 500.25 is being assigned to a variable called total. The variable total is used in a statement no (2) wherein the result of the expression on the right-hand side of (total-100) is being assigned to another variable called net, appearing on the left-hand side of  ' = ' the assignment operator. The point worth noting is that the variable total is being referred by its name in a statement (2) but not by its contents. This important feature of variable makes them a powerful tool in the hand of the programmer.

However, a variable needs to be defined as a particular type before it is used in the program. This activity enables the compiler to make available the appropriate amount of memory for the given type of variable asked by the programmer . The definition of the variable has the following format:

<datatype> <variable name> ;

where datatype is the type of data to be stored and the variable name is the user-defined name of the variable.

  For example, a variable called ' roll ' of type integer can be defined as:

int roll;

 a variable called ' salary ' of type float can be defined as:

float salary;

Example of some valid variables declarations are:

char ch;

int I, j ,k;

float payment;

int roll student;

long num;