Storage Class II-237
6. What are the additional uniqueness of auto variables?
1. The auto variables are defined inside a function. The keyword auto should only be used within
2. The scope of the auto variables is local to the block in which they are defined. Once the execu-
tions of the function take place and return turns off the function, the contents and existence of the
auto variables or local variable vanishes.
3. The auto variables are stored in the main memory. They are stored in the stack at run time.
4. The keyword 'auto' is used for declaration of automatic variables. By default, every variable
pertains to auto storage class. The 'auto' is optional.
7. Write a program on auto variables.
auto int b=7;
printf("\n %d %d",b,c);
auto int b=10;
Explanation: In the above program, declaration and initialization of b is made two times with different
values. In the first block, the b value is 7 and in second block its value is 10. Before passing control to
the second block, the value of b variable printed is 7 and after passing control to the second block, the
value of b is changed to 10. By default, the storage class for c is auto.
8. What are the register variables?
Ans: The 'register' variables are stored in the registers of the CPU. Accessing variables through
the register of the CPU is faster than the memory access.
9. Give the characteristics of register variables.
1. Speed of execution of program is fast because variables are stored in CPU register. Accessing
variables through the CPU register is faster than RAM. The keyword register tells the compiler
that the variable list followed by it is kept on the CPU registers.
M11_ITL-ESL4791_02_SE_C11.indd 237 12/22/2012 5:05:15 PM