Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

An object has a storage duration that determines its lifetime. There are three storage durations: static, automatic, and allocated.

Wiki Markup
According to \[[ISO/IEC 9899-1999|AA. C References#ISO/IEC 9899-1999]\]:

The lifetime of an object is the portion of program execution during which storage is guaranteed to be reserved for it. An object exists, has a constant address, and retains
its last-stored value throughout its lifetime. If an object is referred to outside of its lifetime, the behavior is undefined. The value of a pointer becomes indeterminate when
the object it points to reaches the end of its lifetime.

Non-Compliant Code Example

...