liveBook · Manning

Automatic object

An automatic variable is a variable whose value, behavior, or lifetime is managed implicitly by a programming language or shell rather than controlled entirely by the programmer.

How 2 Manning books explain it

Modern C

An automatic variable is a C variable whose storage is created on entry to its enclosing block and released when execution leaves that block.

How it is used
Explains when local objects exist, including across recursive calls and jumps within a block.
How deep it goes
Defines ordinary lifetimes, works through a compound-literal case, and illustrates storage setup; sets aside separate VLA and temporary-object rules.
Examples
Uses a goto-driven compound literal and its printed pointer comparison, then contrasts unoptimized and optimized assembler versions.
What you can do after
Evaluate/understand when an ordinary local object exists without mistaking its declaration or initialization for the start of its lifetime.

Read how Modern C explains automatic object →

Modern C, Third Edition

An automatic variable is a C object with automatic storage duration, normally created on entry to a block and destroyed on exit from it.

How it is used
Explains local-object lifetime and pointer validity across block entry, recursion, and repeated execution.
How deep it goes
Works through block-lifetime rules and a compound-literal jump example, then illustrates stack setup without making it a language requirement.
Examples
Uses a `goto` loop, its printed pointer comparisons, and unoptimized and optimized assembler listings.
What you can do after
Diagnose/debug with it whether local objects and pointers remain valid across jumps, repeated evaluations, and recursive calls.

Read how Modern C, Third Edition explains automatic object →

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.