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

Since the constant variable has to be declared and defined at the same time, not doing it results in an error.



Your comments will be displayed only after manual approval.