Let's see these declarations one-by-one.
"Auto int"
In C, auto means "not static". Usual local variables are not static by defualt.
There's literally no difference between a local
int a;
and
auto int a;
"Register int"
A programmer uses the "register" keyword for a variable to hint the compiler that this variable is going to be frequently used, and to optimise performance the compiler should keep it in the register.
However, it is perfectly legal for the compiler to flat-out ignore this request, and depend on its judgement on what to put in the registers.
Also, you can't take the address of a register int. (Statement 2)
Hence, using register keyword is unadvisable, as the compiler can ignore it, and you'd also lose the &
operator.
"Static int"
We all know what this is. A static variable is stored in the Runtime environment right at the beginning of the process's execution. Static ints can only be initialised once, and if not initialised by the programmer, they implicitly get initialised to 0 by the compiler.
Note: Global variables too get initialised to 0 if not explicitly initialised by the programmer.
"Const int"
The "const" keyword would keep the value invariable / constant. In other words, it would implement read-only behaviour.
Hence, only for "register int a;" the given declaration would cause a problem, as it's illegal to fetch its address. Option C