A variable is a data name that can be used to store data values. Individual variables that remain unchanged during the execution of a program can take on different values at different times when a variable is executed. In the previous tutorial, we have used several variables.

A variable name can be chosen by the programmer in a meaningful way to reflect its method or nature in the program. Some examples of such names are :

As mentioned earlier, variable names may consist of letters, numbers, and underscores, subject to the following conditions:

  1. They must begin with a letter. Some systems allow underscoring as the first character.
  2. In C standard recognizes a length of 31 characters. The length, however, should generally not exceed eight characters, since only the first eight characters are considered significant by many compilers.
  3. Uppercase and lowercase are significant. That is, the variable "Width" is not the same as "width" or "WIDTH".
  4. It should not be a keyword.
  5. White space is not allowed.

Examples of Variable Names

Variable name Valid? Remark
Circle_area Yes
int No int is a keyword
price$ No Dollar sign is not allowed
circle area No Blank space is not permitted
average_number Yes first eight character are significant
int_type Yes Keyword may be part of a name