Storage Class in C
Storage Classes in C
Storage Classes are used to describe the different features of variables and functions in C programming language.
These features mainly includes the points such as scope of variable, lifetime of variable, the location where the variable will be stored, initial value of variable and who can access the variable or where the variable is accessible.
Types of Storage Classes
In C Programming Language there are four types of storage classes.
- Auto Storage Class
- This is the default storage class for all the variables declared inside a function or a block
- There is no need for writing auto keyword while writing the C program.
- Extern Storage Class
- Extern storage stands for external storage.
- Extern means that variable is declared outside the block where it is used.
- Register Storage Class
- Register storage class is almost same as auto storage class.
- Register storage basically stores variable into CPU register rather than RAM for faster access.
- Static Storage Class
- This storage class is used to declare static variables which are popularly used while writing programs in C language.
- Static variables have a property of preserving their value even after they are out of their scope
Prime Course Trailer
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Get over 200+ course One Subscription
Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others