|
C Function Pointers - August 06, 2008 at 13:10 PM by Amit Satpute
Explain the scope of static variables.
Answer
The scope of a static variable is local to the block in which the variable is
defined. However, the value of the static variable persists between two
function calls.
What is the purpose of "register" keyword.
Answer
It is used to make the computation faster.
The register keyword tells the compiler to store the variable onto the CPU
register if space on the register is available. However, this is a very old
technique. Todays processors are smart enough to assign the registers
themselves and hence using the register keyword can actually slowdown the
operations if the usage is incorrect.
Explain the use of "auto" keyword.
Answer
When a certain variable is declared with the keyword ‘auto’ and initialized to
a certain value, then within the scope of the variable, it is reinitialized
upon being called repeatedly.
|