Difficulty: Easy
Correct Answer: 4
Explanation:
Introduction / Context:Storage classes in C describe the lifetime, visibility, and storage duration of identifiers. Understanding them is essential for reasoning about scope, linkage, and performance hints to the compiler.
Given Data / Assumptions:
Concept / Approach:Each storage class modifies how and where an object exists and how name resolution/linkage works across translation units.
Step-by-Step Solution:
auto: Default for block-scope objects; automatic storage duration; no external linkage.register: Hint that an object may be stored in a CPU register; still block scope; address-of may be restricted historically.static (at block scope): Static storage duration; preserves value across function calls; internal linkage by default at file scope if used with definitions.extern: Declares an object with external linkage defined elsewhere; does not allocate storage by itself (unless it is a tentative definition per older rules).Verification / Alternative check:Any C reference enumerates exactly these four storage classes for classic C. While modern standards refined semantics, the count remains 4 in this canonical sense.
Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:4
Discussion & Comments