Automatic Storage Class
Variables declared within a particular module fall under the automatic storage class It is the default storage class i.e., whenever a variable is declared inside a particular module without any storage class specification it is by default assumed as automatic variable. Their characteristics are:
1. Scope is limited to the module in which they are declared ( i.e., they have local scope).
2. Lifetime equal to lifetime of module i.e., when the module is invoked the automatic variables are created and as soon as the execution of that module is exited the automatic variables are destroyed (i.e., the allocation made to them is reclaimed by the system RAM.)
3. The auto variables get storage inside the main memory (RAM).
4. The default value of these variables is garbage.
Declaration:
Auto int x,y
Where auto is a keyword. Because auto storage class is a default storage class, the keyword auto is optimal. Hence the following statement is equivalent to above statement.
Int x, y:
Register storage class
The register storage class shares all its features with auto storage class except that the storage to these variables is allocated inside the internal of the CPU.The other characteristics are :
1. Scope of these variables is limited to the lifetime of the module in which these variables are declared(local scope)
2. Lifetime of these variables is equal to lifetime of the module in which they are declared.
3. Storage to them is allocated inside the internal register of the CPU.
4. Default value is garbage.
Declaration
Reg int x,y
hese variables are used when the program references the variable very frequently for example the loop variable can be declared as register variable This is because the most time consuming activity CUP does is memory accessing (RAM access) if we made the values available to the CPU (by declaring them in internal registers of CPU), it will speed up the process of execution. The only problem with these variables is that not too many variables can be allocated it the internal of CPU because only few of them are available
Data Structure & Algorithms Assignment Help, Live Experts
Struggling with data structure problems? Data structure subject is quite tough to learn? Need quick assistance in data structure questions? ExpertsMind.com is right place for you where your search ends, We at ExpertsMind offer online data structure assignment help, data structure homework help and data structure and algorithms question's answers by best online support by qualified tutors.
ExpertsMind.com - Automatic Storage Class Assignment Help, Automatic Storage Class Homework Help, Automatic Storage Class Assignment Tutors, Automatic Storage Class Solutions, Automatic Storage Class Answers, What is a Storage Class Assignment Tutors