Home >>C Tutorial >Storage classes in C
Storage classes in C generally represent the visibility and the location of a variable. It basically tells the programmer that from which part of the code he/she can access a variable.
In order to describe the following mentioned things, a storage class in C language is used:
From the above mentioned facts it is clear that a storage class is basically used to represent the information about a variable.
Please note that a variable is generally not only associated with a data type and its value but it is also associated with a storage class.
There are basically four types of standard storage class in C language that is depicted below:
Here is an example of the Storage classes in C that is mentioned below:
#include <stdio.h> int main() { int x =100,i; printf("%d ",++x);//Here scope of a variable is is 101 { int x = 15; for (i=0;i<3;i++) { printf("%d ",x); // this will print 15 3 times } } printf("%d ",x);//Here scope of a variable ended Since output is 101 }