the program, and a static local variable, which has local scope. A static local variable is different from a local variable as a static local variable is initialized only once no matter how many times the function in which it resides is called and its value is retained and accessible through many calls to the function in which it is declared, e.g. to be used as a count variable. A static variable may also have module scope or some variant, such as internal linkage in C, which is a form of file scope or module scope. Example An example of a static local variable in C: #include <stdio.h> void Func() { static int x = 0; // |x| is initialized only once across five calls of |Func| and the variable // will get incremented five times after these calls. The final value of |x| // will be 5. x++; printf("%d\n", x); // outputs the value of |x| } int main() { Func(); // prints 1 Func(); // prints 2 Func(); // prints 3 Func(); // prints 4 Func(); // prints 5 return 0; } Object-oriented programming In object-oriented programming, there is also the concept of a static member variable, which is a "class variable" of a statically defined class, i.e., a member variable of a given class which is shared across all instances (objects), and is accessible as a member variable of these objects. A class variable of a dynamically defined class, in languages where classes can be defined at run time, is allocated when the class is defined and is not static. Object constants known at compile-time, such as string literals, are usually allocated statically. In object-oriented programming, the virtual method tables of classes are usually allocated statically. A statically defined value can also be global in its scope ensuring the same immutable value is used throughout a run for consistency. See also Constant (computer programming) Global variable Static method Thread-local storage Notes References The C++ Programming Language (special edition) by Bjarne Stroustrup (Addison Wesley, 2000; ) Memory management Variable (computer science)