Register Storage Class, Storage Classes in C Language Assignment Help

Assignment Help: >> Storage Classes in C Language >> Register Storage Class, Storage Classes in C Language

Register Storage Class

 The register variable is stored in the computer CPU register, since register access is faster than the memory access. If the CPU fails to keep the variables in CPU registers, in that case the variables are assumed as auto and stored in the memory because CPU registers are limited in numbers. Hence the compiler automatically converts register variables to non register variables once the limit is reached. When you declare float and double variable as register, it treats as auto variable because it takes more space to store.

S.No.

Features of External Variable

Meaning

1.

Storage or location of variable

CPU Register

2.

Initial or default value

Garbage Value or Unpredictable value

3.

Scope of the variable

Local to the block in which the variable is defined

4.

Life of the variable

Till the control remains within the block in which the variable is defined.

Example of Register storage class

main()

{

                register int num;

                for(num=1;num<=5;num++)

                printf("\t%d",num);

}

Output: 1             2              3              4              5

Explanation: The variable num is stored in CPU register till the loop executed successfully.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd