C Variables ?


A variable is a name given to a memory location where the data can be stored. Using the variable name, the data can be stored in memory location and can be accessed or manipulated very easily

Variable in C Programming is also called as container to store the data. Variable name may have different data types to identify the type of value stored. Suppose, we declare variable of type integer then it can store only integer values.

Variable is considered as one of the building block of C Programming which is also called as identifier.



Rules for defining a variable:-

  1. The first character in the variable should be a letter (from a to z or A to Z) or an underscore.
  2. The first character can be followed by any number of letters or digits( 0 to 9) or underscores.
  3. No extra symbols are allowed other than letters, digits, and underscore.
  4. C keywords should not be used as variable names.

Defining a variable :-

Defining a variable means the compiler has to now assign a storage to the variable because it will be used in the program.


Syntax:-    data-type      variable name;
Example:-      int     a;

Initialization of a Variable

Syntax :- Data types Variable Name = data ;
Example:-  int a=5;