Home » C Programming » Variables » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    register const int p = 16;
    p = 17;
    printf("%d\n", p);
    }
    1. Compilation Error
    2. 17
    3. 16
    4. Garbage value
    5. None of these
Correct Option: A

Compilation Error

main.c: In function ‘main’:
main.c:5:11: error: assignment of read-only variable ‘p’
p = 17;



Your comments will be displayed only after manual approval.