Difficulty: Easy
Correct Answer: 1 and 3
Explanation:
Introduction / Context:Correctly distinguishing between declarations and definitions shapes how you structure headers and source files. Declarations introduce names and types; definitions allocate storage or provide function bodies. This question asks you to classify three common patterns you will encounter in real projects.
Given Data / Assumptions:
Concept / Approach:
Step-by-Step Solution:
Line 1 → declaration only (no storage allocated).Line 2 → function body present → definition.Line 3 → prototype only → declaration.Verification / Alternative check:
If you place 1 and 3 in a header and compile multiple translation units, linking succeeds provided there is exactly one definition of 'x' and of the function elsewhere.Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
1 and 3
Discussion & Comments