liveBook · Manning

Storage duration

Storage duration is the C property that determines how long an object exists during program execution and how its storage is managed.

How 2 Manning books explain it

Modern C, Third Edition

Storage duration is the lifetime category that determines when a C object is created, exists, and is initialized or destroyed.

How it is used
Distinguishes an object's lifetime from identifier visibility when reasoning about local, file-scope, and dynamically allocated storage.
How deep it goes
Compares declaration properties and initialization rules, with worked shadowing examples and a storage-class table.
Examples
Traces shadowed local and `extern` declarations, then uses allocated rational-number objects to illustrate initialization functions.
What you can do after
Diagnose/debug with it by separating name visibility from object lifetime and choosing initialization appropriate to storage duration.

Read how Modern C, Third Edition explains storage duration →

Modern C

Storage duration is the C property that specifies how long an object exists during program execution and how its storage is managed.

How it is used
Distinguishes how long an object's storage persists from where its identifier is visible, guiding initialization and dynamic-allocation choices.
How deep it goes
Works through shadowing and extern declarations, compares storage categories, and develops initialization rules; defers finer object-lifetime and machine-stack details.
Examples
Uses shadowed local variables, an extern declaration that selects a file-scope object, and initialization functions for allocated data.
What you can do after
Diagnose/debug with it by separating identifier shadowing from object identity and deciding which objects require explicit initialization.

Read how Modern C explains storage duration →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.