Variables are means for location in memory used by a program to store data. The size of that block depends upon the range over which the variable is allowed to vary. For example, on personal computer the size of an integer variable is two bytes, and that of a long integer is four bytes.

To identify the variables, you have a name unique to every single variable. This is called a variable name. Before using a variable, use variables to what is called a variable declaration that you have to reveal the names and data types that can be stored in the variable variable.

  • A constant is an entity that doesn’t change, whereas, a variable is an entity that may change.
  • A variable is nothing but a user defined element. A variable is a name that represents a memory location that can store a value.

In general, a variable has three properties :

  • A memory location to hold the value.
  • Types of the value stored.
  • The name used to refer the memory location.

Rules of Variable Formation

  • Keywords of C cannot be used as variables name.
  • A digit [0-9] may not start a variable name.
  • Variable name must be of maximum 8-character in length.
  • Variable name must start with alphabet or underscore (_ ) it should not start with number or special symbol.
  • It should not contain ( comma ) ‘,’ or space in name. [example: Area ]

Defining Variable

Variables can be define by using syntax.

    Syntax: Data type variable list

Ex: - int a ,b;
float x;
int a=3,b=2,c=4118;