Content deleted Content added
mNo edit summary |
m →Static Variables as Local Function Variables: link repair (You can help!) |
||
Line 9:
==Static Variables as Local Function Variables==
Most programming languages include the concept of [[functions]] (also known as [[methods]] or [[procedures]]). These structures resemble smaller programs that can be ''called'' as subtasks from the main application, or even from other subtasks. Functions simply perform their intended operation and return control to the caller. Usually, any [[
Some languages allow functions to ''retain'' the value of variables between calls, so that the function can preserve its [[state]] if necessary. For example, with a static variable a function could record the number of times it has been executed using an internal counter. This would only otherwise be possible using [[global variables]] or an external storage method, like a file on disk.
|