Register type

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 type

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.

AutomaticRegister
Identifier: auto Identifier: register
Access time is slower than registerAccess time is fastest
Storage is in memory/cacheStorage is in CPU register
Large number of variables can be createdVery 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.

 Vote 0

Similar topics related to this section

data types, storage classes, volatile variable, external vs static, global vs static variable, register vs auto variable, const, sizeof void, if, if-else, if-else-if,

# C Programming Language (Prentice Hall Software)
# Let Us C Paperback - 2006 by Yashavant Kanetkar
# Understanding and Using C Pointers Core techniques for memory management
# Data Structures Using C and C++ Paperback - 1998
# Data Structures In C Paperback - August 11, 2008 by Noel Kalicharan