C | Storage Classes and Type Qualifiers | Question 19

Output?

filter_none

edit
close

play_arrow

link
brightness_4
code

#include <stdio.h>
int main()
{
  register int i = 10;
  int *ptr = &i;
  printf("%d", *ptr);
  return 0;
}

chevron_right


(A) Prints 10 on all compilers
(B) May generate compiler Error
(C) Prints 0 on all compilers
(D) May generate runtime Error


Answer: (B)

Explanation: See point 1 of Register Keyword

Quiz of this Question



My Personal Notes arrow_drop_up