Q6 Write C programs to compare the execution time & compilation time for all the four storage classes variables.
Program: 144
Write C programs to compare the execution time & compilation time for all the four storage classes variables
Variable Storage Class tells us:
- Storage (location)
- Default Initial Value of the variable
- Scope of the variable
- Life of the variable
1. Storage: Where the variable would be stored.
2. Default Initial Value: What will be the initial value of the variable, if initial value is not specifically assigned. (i.e. the default initial value)
3. Scope: What is the scope of the variable: i.e. in which functions the value of the variable would be available.
4. Life: What is the life of the variable: i.e. how long would the variable exist.
Automatic Storage Class Variable
Output:
0.293000
Register Storage Class Variable
Output:
0.053000
Static Storage Class Variable
Output:
0.282000
External Storage Class Variable
Output:
0.305000
So the Winner is Register Storage Class