C Variables

Variables are used to store some value. the value of variable can be changed. we should define the data type of variable and after that the name should be given to the variable. Variable is place, where we store some value of our variable and data type tell us the range of storage area.

  Rules of C Variables Declaration :-


  First character must be an alphabet or underscore of the variable.

  It must consists of only letters, digits  or a underscore.

 Only first 31 characters are significant .

 It can not use a keyword, to declare a variable.

 it must not contain white space.

Example :-

int    a, b;     write way to declare a variable

float   c, d;  

char  ch;    

int  float;    Wrong way to declare a variable

int  while;  


  Example :-

void main()
int a=12;
int b=23;
int c;
printf("Sum of a and b is=%d",c);



   Result :-

 Sum of a and b is=35

   Explanation : –

In the Above Example we have two variables a and b, their type is int. We assign them integer type value.

One variable is c, which have no value. C was declared only, but later, We assign them value. Now C has sum of a and b.


Follow Us

Contact Us


Back to Top