Static (keyword)

In some programming languages such as C (and its close descendants like C++, Objective-C, and Java), codice_1 is a reserved word controlling both lifetime (as a static variable) and visibility (depending on "linkage"). The effect of the keyword varies depending on the details of the specific programming language.
Common C/C++ behavior.
In C and C++, the effect of the codice_1 keyword in C depends on where the declaration occurs.
codice_1 may act as a storage class (not to be confused with classes in object-oriented programming), as can codice_4, codice_5 and codice_6 (which are also reserved words). Every variable and function has one of these storage classes; if a declaration does not specify the storage class, a context-dependent default is used:
In these languages, the term "static variable" has two meanings which are easy to confuse:
Variables with storage class codice_4, which include variables declared at top level without an explicit storage class, are codice_1 in the first meaning but not the second.
Static global variable.
A variable declared as codice_1 at the top level of a source file (outside any function definitions) is only visible throughout that file ("file scope", also known as "internal linkage"). In this usage, the keyword codice_1 is known as an "access specifier".
Static function.
Similarly, a static functiona function declared as codice_1 at the top level of a source file (outside any class definitions)is only visible throughout that file ("file scope", also known as "internal linkage").
Static local variables.
Variables declared as codice_1 inside a function are statically allocated, thus keep their memory location throughout all program execution, while having the same scope of visibility as automatic local variables (codice_5 and codice_6), meaning they remain local to the function. Hence whatever values the function puts into its static local variables during one call will still be present when the function is called again.
C++ specific.
Static member variables.
In C++, member variables declared as codice_1 inside class definitions are class variables (shared between all class instances, as opposed to instance variables).
Static method.
Similarly, a static methoda method declared as codice_1 inside a class definitionis meant to be relevant to all instances of a class rather than any specific instance. A method declared as codice_1 can be called without instantiating the class.