answersLogoWhite

0


Best Answer

register behaves like auto class but auto variables are actually local variables.They are created when the functions are created but they are destroyed when the fns is exited.But register-variables are used to speed up the operations

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

keyword register can be used for parameters and local variables, it means two things:

- it is often used variable (parameter), so the compiler might want to use a CPU-register to optimize its using.

- the programmer swears that he won't ever use the address of that variable (parameter)

example:

size_t strlen (register const char *s)

{

register const char *q= s-1;

while (*++q);

return q-s;

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between auto storage class and register storage class?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the default value of register storage class?

Register storage class is a compiler hint that the variable will be often used, and that it should generate code, if it can, to keep the variable's value in a register.


Storage classes available in c language?

There are four types of storage class or variable in c. 1) auto storage class. 2) register storage class. 3) static storage class. 4) external storage class.


What is different storage class in c?

Different from what? Storage classes are auto, register, static, extern and typedef (formally).


What is storage claases in c language?

storage classes is important part of c language.WHENEVER we define any function in c program then we can call that in every definend class. there are four types of storage class. these are... 1 AUTO OR AUTOMATIC STORAGE CLASS 2 REGISTER STORAGE CLASS 3 STATIC STORAGE CLASS 4 EXTERNALSTORAGE CLASS 1) The features of "AUTOMETIC" storage class are as under some conditions: storage : storage will be in memory. value : garbage value. scope : scope is local to block to the variable. life : till, controls remain within the block. 2) The featurs of "STATIC" storage class are as under some conditions: storage : memory. value : zero. scope : local to block. life : Till control remains within the block. 3) The featurs of "REGISTER" storage class are as under some conditions: storage : register. value : garbage value. scope : local to the block. life : value persists between variable. 4) The feature of "EXTERNAL" storage class are as under some conditions: storage : memory. value : zero. scope : local to block. life : till controls remains within the block.


What is the difference between datatypes and modifiers in c language?

For example 'int' is a data-type, 'short', 'long', 'signed' and 'unsigned' are modifiers, 'extern', 'auto', 'static', 'register' are storage-classes. The declarations go like this: storage-class modifiers data-type identifier example: static unsigned short int x;

Related questions

What is the default value of register storage class?

Register storage class is a compiler hint that the variable will be often used, and that it should generate code, if it can, to keep the variable's value in a register.


Storage classes available in c language?

There are four types of storage class or variable in c. 1) auto storage class. 2) register storage class. 3) static storage class. 4) external storage class.


What is class register?

Register storage class is a compiler hint that the variable will be often used, and that it should generate code, if it can, to keep the variable's value in a register.


What is the difference between an auto storage class and a register storage class in c?

The register storage class specifier is typically used for a heavily-used primitive data type, such as a loop control variable, and indicates to the compiler that this variable should be stored in a machine register to reduce access time. However, there are very few registers available and they are limited in size, so the compiler is free to ignore the specifier, in which case the variable is treated as if it were specified as an auto storage class. The auto storage class specifier allows you to explicitly declare a variable with automatic storage. Such variables are treated as being local to the block, and will fall from scope when the block ends. Since this is the default behaviour of all local variables, the auto specifier is redundant.


What is different storage class in c?

Different from what? Storage classes are auto, register, static, extern and typedef (formally).


What are the different storage class in C programming?

Automatic, register, external, static


What is storage claases in c language?

storage classes is important part of c language.WHENEVER we define any function in c program then we can call that in every definend class. there are four types of storage class. these are... 1 AUTO OR AUTOMATIC STORAGE CLASS 2 REGISTER STORAGE CLASS 3 STATIC STORAGE CLASS 4 EXTERNALSTORAGE CLASS 1) The features of "AUTOMETIC" storage class are as under some conditions: storage : storage will be in memory. value : garbage value. scope : scope is local to block to the variable. life : till, controls remain within the block. 2) The featurs of "STATIC" storage class are as under some conditions: storage : memory. value : zero. scope : local to block. life : Till control remains within the block. 3) The featurs of "REGISTER" storage class are as under some conditions: storage : register. value : garbage value. scope : local to the block. life : value persists between variable. 4) The feature of "EXTERNAL" storage class are as under some conditions: storage : memory. value : zero. scope : local to block. life : till controls remains within the block.


What is the difference between datatypes and modifiers in c language?

For example 'int' is a data-type, 'short', 'long', 'signed' and 'unsigned' are modifiers, 'extern', 'auto', 'static', 'register' are storage-classes. The declarations go like this: storage-class modifiers data-type identifier example: static unsigned short int x;


Register in c?

A storage class, outdated but still usable. Example:size_t strlen (register char *p){register char *s= p-1;while (*++s);return s-p;}


What is storage classes in c plus plus?

AUTO EXTERN STATIC are the storage classes in c++


Why you need to declare auto storage class specifier in c language?

We don't. The auto storage class is the default storage class for all local variables and is therefore completely redundant in C. It exists for no other reason than that C evolved from B and inherited all its storage classes (auto, static, extern and register).


What is meant by the storage class of a variable?

auto, extern, static, register, typedef (only formally)