Multiple choice technology programming languages

What will be the output of the following: void main() { register int a; printf("%d",a); }

  1. 0

  2. Garbage value

  3. Compile time error

  4. 1

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In C, local variables (including those declared with the register storage class) are not automatically initialized. Reading an uninitialized local variable results in undefined behavior, which typically prints whatever garbage value happens to be in that register or memory location.