Sail E0 Webinar
Question
Whats is the output of this C code?
void main()
{
int const k = 11;
k++;
printf("k is %d", k);
}
Options:
A .  k is 12
B .  Error because const and int are used together
C .  garbage value
D .  Error, because a constant variable cannot be changed
Answer: Option D


Constant variable has to be declared and defined at the same time. Trying to change it later results in error.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers