Top

Discussion

Whats is the output of this C code?

void main()
{
int const k = 11;
k++;
printf("k is %d", k);
}

 

  • 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: D

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

No comment is present. Be the first to comment.
Loading…

Post your comment