Related Articles

Related Articles

C++ | const keyword | Question 5
  • Difficulty Level : Easy
  • Last Updated : 05 Feb, 2014
filter_none

edit
close

play_arrow

link
brightness_4
code

#include <stdio.h>
int main()
{
   const int x;
   x = 10;
   printf("%d", x);
   return 0;
}

chevron_right


(A) Compiler Error
(B) 10
(C) 0
(D) Runtime Error


Answer: (A)

Explanation: One cannot change the value of ‘const’ variable except at the time of initialization. Compiler does check this.

Quiz of this Question

Attention reader! Don’t stop learning now. Get hold of all the important C++ Foundation and STL concepts with the C++ Foundation and STL courses at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :