Register variables are stored in the CPU registers of microprocessors/micro-controllers.
The read/write access to register variables is the fastest because CPU never needs to perform any memory BUS operations to access these variables.
Automatic variable are declared inside local function scope and stored in stack memory which makes access to these variables much slower than registers.
However there are cache memory to do optimization in CPU level but cache memory is not as fast as CPU registers.
Auto variables can be converted to register variables by putting the register identifier before it.
It has platform specific limitations. Register variables will work only if free registers are available to hold the variable for a function scope.
In case of Microprocessors or micro-controllers having very less number of general purpose registers, register variables will never be taken even if declared as register.
Access time is slower than register
Access time is fastest
Storage is in memory/cache
Storage is in CPU register
Large number of variables can be created
Very few variable can be created
You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.