Academic Program

Variable Scope Lifetime

Variable Scope Lifetime

  • The scope and lifetime of a variable depending on its storage class:
    • Automatic Variables
    • Static Variables
    • External Variables
    • Register Variables
  • Scope refers to where in a program a variable may be accessed.
  • Lifetime refers to how long a variable will exist or retain its value.