Difficulty: Easy
Correct Answer: 20
Explanation:
Introduction / Context:Constants in C can be initialized with constant expressions or the results of function calls that are evaluated at runtime before first use. The const qualifier means the object cannot be modified after initialization, not that its initializer must be a compile-time literal. This problem clarifies that distinction by initializing a const int using a function that returns a known value and then printing it.
Given Data / Assumptions:
Concept / Approach:
Step-by-Step Solution:
Call get() during initialization → result 20.Bind result to x as a const int → x holds 20 and is read-only thereafter.printf("%d", x) → prints 20.Verification / Alternative check:
If get() returned a different integer, that value would be printed; the presence of const does not change the initialization semantics.Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
20
Discussion & Comments