← Quiz: C Data Types and Operators: all 10 questions
Quiz: C Data Types and Operators · Question 9 of 10
What happens with const int MAX = 10; followed later by MAX = 20;?
What happens with const int MAX = 10; followed later by MAX = 20;?
- A.MAX becomes 20
- B.MAX stays 10 silently
- C.Compile error: a const variable cannot be assigned
- D.The program crashes at run time
Answer & explanation
Correct answer: Compile error: a const variable cannot be assigned
const makes the compiler reject any attempt to change the value.
Can you get the rest right without peeking?
Take the timed Quiz: C Data Types and Operators quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →