Difficulty: Medium
Correct Answer: 3 correct
Explanation:
Introduction / Context:
This checks precision with C declarations. After introducing a typedef name, you must use it as a standalone type specifier. Mixing it with conflicting specifiers leads to invalid syntax or redeclaration errors.
Given Data / Assumptions:
Concept / Approach:
Once typedef long a; is processed, a is an alias for long and should be used by itself in place of long. A valid extern declaration using the alias is extern a c; which is equivalent to extern long c;. Combining a with another basic type keyword (like int) is invalid because a already denotes a complete type.
Step-by-Step Solution:
Line 1: extern int a c; → invalid: conflicts and malformed declarators.Line 2: extern a int c; → invalid: cannot combine typedef name a with int.Line 3: extern a c; → valid: equivalent to extern long c;.Therefore, only line 3 is correct.
Verification / Alternative check:
Compiling the three lines independently confirms that only the third form is accepted by a conforming compiler.
Why Other Options Are Wrong:
1 correct / 2 correct: both lines contain invalid combinations.All correct: contradicts compiler behavior.None are correct: false because line 3 is valid.
Common Pitfalls:
Forgetting that typedef names are type aliases, not modifiers; attempting to stack a with other base types; writing extern in a way that changes storage class rather than type.
Final Answer:
3 correct
Discussion & Comments