When you apply the static modifier to a local variable, the compiler creates permanent storage for it,
much as it creates storage for a global variable. The key difference between a static local variable
and a global variable is that the static local variable remains known only to the block in which it is
declared. In simple terms, a static local variable is a local variable that retains its value between
function calls.
static local variables are very important to the creation of stand-alone functions because several
types of routines must preserve a value between calls. If static variables were not allowed, globals
would have to be used, opening the door to possible side effects.
Saturday, July 19, 2008
static Local Variables
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment