Home » C Programming » Constants » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    int n = 21;
    int *const m = &n;
    int s = 12;
    m = &s;
    printf("%d", m);
    }
    1. 21
    2. Compilation Error
    3. 12
    4. Runtime Error
    5. None of these
Correct Option: B

Since the pointer m is declared to be constant, trying to assign it with a new value results in an error.



Your comments will be displayed only after manual approval.