Home » C Programming » Variables » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    const int k = 11;
    int *p = &k;
    *p = 22;
    printf("%d\n", k);
    return 0;
    }
    1. 11
    2. Compilation Error
    3. 22
    4. Runtime Error
    5. None of these
Correct Option: C

Changing const variable through non-constant pointers invokes compiler warning.



Your comments will be displayed only after manual approval.