Difficulty: Easy
Correct Answer: Error
Explanation:
Introduction / Context:
This question checks whether you recognize that enum identifiers represent constant values, not variables. Applying increment operators to constants is illegal in C.
Given Data / Assumptions:
Concept / Approach:
Increment operators require a modifiable lvalue. Enum constants are compile-time integral constants, not objects with storage that can be incremented. Therefore, ++MON is invalid and causes a compilation error.
Step-by-Step Solution:
Verification / Alternative check:
Replacing ++MON with MON would compile and print the values -1, 0, 6, 7, 8, 9. The error arises solely from trying to modify a constant identifier.
Why Other Options Are Wrong:
Common Pitfalls:
Treating enum names like variables or expecting them to behave like ordinary ints that can be incremented in-place.
Final Answer:
Error
Discussion & Comments