Compiler will give an error if we attempt to get the address of a variable - register keyword

Q.  C programming: The compiler will give an error if we attempt to get the address of a variable with _________ storage class.
- Published on 24 Jun 15

a. register keyword
b. extern keyword
c. static keyword
d. auto keyword

ANSWER: register keyword
 
Registers are faster to access, so the variables which are most frequently used in a C program can be put in registers using register keyword. The keyword register hints to compiler that a given variable can be put in a register. It’s compiler’s choice to put it in a register or not. Compilers themselves do optimizations and put the variables in register.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)