What will the output of the following C code be?#include stdio.h> void main() int const k = 5; k++; printf("k is percent d", k);
A. k is six.
B. Error due to const successful int
C. Error, since a constant variable can only be modified twice.
D. Error, since a constant variable cannot be altereD.
Answer:D
What will the output of the following C code be?#include stdio.h> void main() int const k = 5; k++; printf("k is percent d", k);
A. k is six. B. Error due to const successful int C. Error, since a constant variable can only be modified twice. D. Error, since a constant variable cannot be altereD.
Explanation: Constant variables must be declared and defined at the same time. Attempting to modify it results in an error. Output: $ cc pgm12.c pgm12.c: In the function'main,' the following code is found: pgm12.c:5: error: read-only variable 'k' was increased