Difficulty: Easy
Correct Answer: Automatic (block) storage by default for local declarations.
Explanation:
Introduction / Context:
C variables have storage duration depending on where and how they are declared. This question focuses on a structure variable declared inside a block with no storage-class specifier.
Given Data / Assumptions:
Concept / Approach:
Local variables declared inside a block have automatic storage duration by default. They are created upon block entry and destroyed when the block is exited. This rule applies to any type, including structs.
Step-by-Step Solution:
1) Place the declaration inside a function or compound statement. 2) Omit storage keywords; the default is automatic. 3) The object has block scope and automatic lifetime. 4) Contrast with file-scope declarations, which by default have static storage duration.
Verification / Alternative check:
Compile with a local struct variable and inspect lifetime via prints or address changes across calls; automatic objects get new storage each call unless declared static.
Why Other Options Are Wrong:
Option B: Static requires the static keyword or file scope. Option C: register is only a hint and not default. Option D: Thread storage uses _Thread_local or similar, not default. Option E: External linkage is about identifiers, not automatic lifetime.
Common Pitfalls:
Confusing storage duration (automatic vs static) with linkage and scope; assuming structs behave differently from scalars.
Final Answer:
Automatic storage duration for local (block-scope) struct variables.
Discussion & Comments