Explain Binding of a variable in C language.

Storage classes specify the scope, lifetime and binding of variables.

To fully define a variable, one needs to mention not only its ‘type’ but also its storage class.

A variable name identifies some physical location within computer memory, where a collection of bits are allocated for storing values of variable.

Storage class tells us the following factors

  • Where the variable is stored (in memory or cpu register)?
  • What will be the initial value of variable, if nothing is initialized?
  • What is the scope of variable (where it can be accessed)?
  • What is the life of a variable?


Binding finds the corresponding binding occurrence (declaration/definition) for an applied occurrence (usage) of an identifier.

  • Scope of variables should be known.

What is the block structure?

In which block the identifier is variable?

  • What will happen if we use same identifier name again?

‘C’ forbids use of same identifier name in the same scope.

Same name can be used in different scopes.


double f,y;
int f( ) //error {
double y; //error


double y;
int f( ){
   double f;//legal
   int y; //legal


Following is the C program for binding of a variable −

 Live Demo

int i=33;
main() {
   extern int i; {
      int i=22; {
         const volatile unsigned i=11;
",i);       }       printf("i=%d",i);    } }


When the above program is executed, it produces the following output −