Automatic ( Auto ) storage class in C Programming
- This is default storage class
- All variables declared are of type Auto by default
- 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 : 60Num : 20Note :
Two variables are declared in different blocks , so they are treated as different variables
Bookmark & Share
