Home » C Programming » Constants » Question
  1. Which of the following is the correct output for the program given below?
    #include<stdio.h>
    int main()
    {
    const int k = 10;
    printf("%d\n", k++);
    return 0;
    }
    1. 10
    2. 1 1
    3. No output
    4. Error: ++ needs a l value
Correct Option: D

k is a constant, so increment of read-only variable ‘k’ is not possible.
Error: ++ needs a l value



Your comments will be displayed only after manual approval.