Storage classes in C - register and auto

Register storage specifier

Using the register storage specifier you can request the compiler to keep the variable inside the CPU register instead of keeping it inside the memory. This makes access to the data in these variables very fast.

Important

Its upto the compiler if it wants to store the variable inside the register or treat it like a normal variable. Even if you mark a variable as register it's not guaranteed that it will be kept inside a register.

Global variables cannot be marked with register storage specifier. You can only mark local variables with register storage.

Auto storage specifier

All local variables are automatic by default. So it does not matter if you mark local variables with auto storage specifier or not.

Related Questions

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp