DEFINITION:-
Storage class define the scope(visibilty) and life time of a variables or functions within a C program.Storage class are associated with the variables for describing the features of any variables or functions.There are 4 types of storage classes:
- auto:- auto is the default storage class for all local variable(i.e the variable inside function).auto keyword is used to define the storage classes.
register :- register is used to define the local variables that should be stored in a register instead of RAM(random access memory) , this means that unary operator (& or reference) can't applied.Register variables work fast than the variable stored in RAM.Register variable are used for looping.
static:- it is the default storage classes for global variables.global static variable can be accessed in any part of the program.The default value is assigned 0 by the compiler.static keyword is used to define the static variable.
extern:- the extern is used to feature a variables to be used from different blocks within the same program. for extern storage class , extern is used.to give a reference of a global variable that is visible to all the program files.





Comments
Post a Comment