Content deleted Content added
→Static local variables: added a ref |
|||
Line 11:
A special type of local variable, called a static local, is available in many mainstream languages, including [[C (programming language)|C]]/[[C++]], [[Visual Basic]] and [[Visual Basic .NET|VB.NET]], which allows a value to be retained from one call of the function to another. In this case, recursive calls to the function also have access to the variable. In all of the above languages, variables are declared as such with a special ''storage class'' keyword (e.g., <code>static</code>).
Static locals in global functions can be thought of as global variables, because their value remains in memory for the life of the program.<ref>{{PDFlink|[http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf Current C standard]|3.61 MB<!-- application/pdf, 3788603 bytes -->}} (
Stricter and more formal [[Object-oriented programming|object-oriented]] languages such as [[Java (programming language)|Java]] and [[C Sharp (programming language)|C#]], do not allow local variables to be declared static to a function.
|