C - Static Variables

From EdWiki

Static Variables

  • A static variable is like a global variable, except that, it limits the scope of that variable to a function or to a file.
  • If static declaration is applied to automatic variables, they remain in existence, rather than coming and going each time the function is activated. Thus, automatic variables with static storage provide private, permanent storage with in a single function.
  • If static storage is applied to a function or to a global variable , its name is invisible outside of the source file in which it is declared.