Constants


  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. View Hint View Answer Discuss in Forum

    Error: increment of read-only variable ‘k’

    Correct Option: D

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