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.

According to C11the C Standard, Section section 6.2.4, para. paragraph 2 [ISO/IEC 9899:2011],

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.

...

ISO/IEC 9899:2011 Section 6.2.4, "Storage durations of objects," and Section section 7.22.3, "Memory management functions"

...