Tuesday, December 25, 2012

C Tutorial

What are the storage classes in c?
Storage classes can be defined as how long variable is visible what is life of variable .When variable is lost where variable can be accessed .
Storage classes are 4 types
1)Local variable (or) automatic variable
2)Global variable
3)Static variable
4)Register variable
 
Ex:



     int a=10;
     int b;
    
    void main()
                {
                   auto int c=20;
                   intd=30;
                   int a=40;
                   int e;  
                        
                                       }
                       
                  f1()
                   {
                                autoint f=50;
                                int c=60;
                                 int b=70;   
                                                               }
c,d,a,e are local variable to main() .They visible to main() only they can't be accessed from f1().f,c,b arelocal variable to f1().They are visible f1() they can't be accessed from main()

            a,b are global variable they visible to hole program they can be accessed from main(),f1()

No comments:

Post a Comment