C variable declaration

What is Declaration ?

  • To Declare is nothing but to represent a variable.
  • Only Variable name and its Data type is Represented in Declaration.

Facts about Declaration :

  1. Memory is neither allocated to Variable nor space is Reserved after declaration.
  2. Declaration is just used for Identification of Data Type.
  3. Re-Declaration of variable will cause compile Error.
int ivar;
int ivar = 10;

It will cause compile error. We cannot re-declare variable.

  1. We cannot use variable inside program expression or in program statements without declaring.
  2. Declaring a variable just give rough idea to compiler that there is something which is of type “<Data Type Specified>” and will be used in the program.

Example Of Declaration :

int ivar;
float fvar;
char cvar;