July 10, 2011

difference between locally and globally static variables.

Difference between locally and globally static variables.

1) Global Static variables are initialized at the beginning of the program.
Local Static variables are initialized only when the function containing the variable is called.

2) Local Static variable is accessed by only the function in which it is declared.
Global Static variable can be accessed by all the function in the program (with in a file in which they declared).

3) Global Static variables are not accessed by any other file.
Local Static variables are not accessed from outside the function in which they declared.