C++ | const keyword | Question 5
#include <stdio.h>int main(){ const int x; x = 10; printf("%d", x); return 0;} |
(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
Want to learn from the best curated videos and practice problems, check out the C Foundation Course for Basic to Advanced C.



