Right Click to Search

Sunday, January 24, 2025

Automatic ( Auto ) storage class in C Programming




Automatic ( Auto ) storage class in C Programming

  1. This is default storage class
  2. All variables declared are of type Auto by default 
  3. In order to Explicit declaration of variable use 'auto' keyword
auto int num1 ;   // Explicit Declaration  
Features :
 Storage
Memory
 Scope
Local / Block Scope
 Life time

Exists as long as Control remains in the block
 Default initial Value

Garbage

Live Example :

void main()
{
 auto mum = 20 ;
 {
      auto num = 60 ;
             printf("\nNum : %d",num);
 }
 printf("\nNum : %d",num);
}

Output :
Num : 60
Num : 20

Note :
Two variables are declared in different blocks , so they are treated as different variables

Bookmark & Share

Stumble
Delicious
Technorati
Twitter
Facebook

0 Comments:

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email

 

Learn C Programming Copyright © 2010 LKart Theme is Designed by Lasantha, Free Blogger Templates