What will be the output of the program?

int main()
    const int i=0;
    printf('%d\n', i++);
    return 0;

A No output

B 11

C 10

D Error: ++needs a value

ANS:A - 10

This program will show an error 'Cannot modify a const object'. Step 1: const int i=0; The constant variable 'i' is declared as an integer and initialized with value of '0'(zero). Step 2: printf('%d\n', i++); Here the variable 'i' is increemented by 1(one). This will create an error 'Cannot modify a const object'. Because, we cannot modify a const variable.

img not found

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.