[prev] [index] [next]

Lifetime

Lifetime: duration that a variable is available in memory.

Variables in the global data ...

  • exist for the entire duration of program execution
Objects in the heap ...
  • are explicitly created via malloc(), removed by free() (see later)
Objects in the stack ...
  • are created automatically when the function is invoked
  • are removed automatically when the function returns