Home » C Programming » Variables » Question
  1. What will be the output of the following C code?
     #include <stdio.h>
    int main()
    {
    register int n = 110;
    int *ptr = &n;
    *ptr = 111;
    printf("%d %d\n", n, *ptr);
    }
    1. 110 111
    2. 111 110
    3. 111
    4. 110
    5. Compilation Error
Correct Option: E

Compilation Error

main.c: In function ‘main’:
main.c:5:9: error: address of register variable ‘n’ requested
int *ptr = &n;



Your comments will be displayed only after manual approval.