01 04 Storage Class
01 04 Storage Class
Storage class is used to define the lifetime and visibility of a variable and/or function
within a C++ program.
Lifetime refers to the period during which the variable remains active and visibility
refers to the module of a program in which the variable is accessible.
There are five types of storage classes, which can be used in a C++ program
1. Automatic It is the default storage class for all local variables. The auto keyword is
applied to all local variables automatically.
2. Register allocates memory in register than RAM. Its size is same of register size. It has
a faster access than other variables.
3. Static is initialized only once and exists till the end of a program. It retains its value
between multiple functions call.
4. External variable is visible to all the programs
5. Mutable