Every variable in C or other language have two main features namely:
- Data Types
- Storage class
From C compiler's point of view, a variable name identifies some physical location within the computer where the string of bits representing the variable's value stored. There are basically two kinds of locations in a computer where such a value may be kept- Memory and CPU registers. It is the variable's storage class that determines in which of there two types of locations, the value is stored.
Moreover, a variable's storage class tells us:
- Memory location i.e. where variable would be stored.
- Initial value or default value of variable
- What is scope of the variable
- What is life of the variable
Scope of variable:
Scope of variable i.e. in which function the value of the variable would be available.
Life of the variable:
The life of the variable i.e. how long would the variable exists.
There are four storage classes in C :
No comments:
Post a Comment