The features of a register storage variable as following manner:
|Default initial value||Garbage value i.e. an unpredictable value|
|Scope||Local to the block, in which the variable is defined|
|Life||Till the control remains within the block in which the variable is defined|
There are no guaranty that we have declare any variable as register and it would be stored in CPU register! Why? The reason is because CPU register are limited, and they may be busy doing some other task. In this case that variable works as default storage class i.e. automatic storage class.
Note: Any variable stored in CPU register or not depend on capacity of microprocessor. For example, if the microprocessor has 16-bit register then they cannot hold a float value or a double value, which require 4 and 8 bytes respectively.
However, if you use the register storage class for float, double variable then you won't get any error messages because compiler treat it as default storage class i.e. auto storage class.
/*shows uses of register storage class*/
register int i;
for(i=10; i>=0; i=i-2)
10 8 6 4 2 0
You might also like to read: