<s>
In	O
computer	B-General_Concept
programming	I-General_Concept
,	O
a	O
static	B-General_Concept
variable	I-General_Concept
is	O
a	O
variable	O
that	O
has	O
been	O
allocated	B-General_Concept
"	O
statically	O
"	O
,	O
meaning	O
that	O
its	O
lifetime	O
(	O
or	O
"	O
extent	O
"	O
)	O
is	O
the	O
entire	O
run	O
of	O
the	O
program	O
.	O
</s>
<s>
This	O
is	O
in	O
contrast	O
to	O
shorter-lived	O
automatic	B-General_Concept
variables	I-General_Concept
,	O
whose	O
storage	O
is	O
stack	B-General_Concept
allocated	I-General_Concept
and	O
deallocated	O
on	O
the	O
call	B-General_Concept
stack	I-General_Concept
;	O
and	O
in	O
contrast	O
to	O
objects	O
,	O
whose	O
storage	O
is	O
dynamically	B-General_Concept
allocated	I-General_Concept
and	O
deallocated	O
in	O
heap	O
memory	O
.	O
</s>
<s>
Variable	O
lifetime	O
is	O
contrasted	O
with	O
scope	B-Language
(	O
where	O
a	O
variable	O
can	O
be	O
used	O
)	O
:	O
"	O
global	O
"	O
and	O
"	O
local	O
"	O
refer	O
to	O
scope	B-Language
,	O
not	O
lifetime	O
,	O
but	O
scope	B-Language
often	O
implies	O
lifetime	O
.	O
</s>
<s>
In	O
general	O
,	O
is	O
the	O
allocation	O
of	O
memory	O
at	O
compile	B-Application
time	I-Application
,	O
before	O
the	O
associated	O
program	O
is	O
executed	O
,	O
unlike	O
dynamic	B-General_Concept
memory	I-General_Concept
allocation	I-General_Concept
or	O
automatic	B-General_Concept
memory	I-General_Concept
allocation	I-General_Concept
where	O
memory	O
is	O
allocated	B-General_Concept
as	O
required	O
at	O
run	B-Library
time	I-Library
.	O
</s>
<s>
Static	B-General_Concept
variables	I-General_Concept
date	O
at	O
least	O
to	O
ALGOL	B-Language
60	I-Language
(	O
1960	O
)	O
,	O
where	O
they	O
are	O
known	O
as	O
own	O
variables	O
:	O
</s>
<s>
This	O
definition	O
is	O
subtly	O
different	O
from	O
a	O
static	B-General_Concept
variable	I-General_Concept
:	O
it	O
only	O
specifies	O
behavior	O
,	O
and	O
hence	O
lifetime	O
,	O
not	O
storage	O
:	O
an	O
own	O
variable	O
can	O
be	O
allocated	B-General_Concept
when	O
a	O
function	O
is	O
first	O
called	O
,	O
for	O
instance	O
,	O
rather	O
than	O
at	O
program	O
load	B-Operating_System
time	I-Operating_System
.	O
</s>
<s>
The	O
use	O
of	O
the	O
word	O
static	O
to	O
refer	O
to	O
these	O
variables	O
dates	O
at	O
least	O
to	O
BCPL	B-Language
(	O
1966	O
)	O
,	O
and	O
has	O
been	O
popularized	O
by	O
the	O
C	B-Language
programming	I-Language
language	I-Language
,	O
which	O
was	O
heavily	O
influenced	O
by	O
BCPL	B-Language
.	O
</s>
<s>
The	O
BCPL	B-Language
definition	O
reads	O
:	O
</s>
<s>
Note	O
that	O
BCPL	B-Language
defined	O
a	O
"	O
dynamic	O
data	O
item	O
"	O
for	O
what	O
is	O
now	O
called	O
an	O
automatic	B-General_Concept
variable	I-General_Concept
(	O
local	O
,	O
stack-allocated	O
)	O
,	O
not	O
for	O
heap-allocated	O
objects	O
,	O
which	O
is	O
the	O
current	O
use	O
of	O
the	O
term	O
dynamic	O
allocation	O
.	O
</s>
<s>
The	O
static	O
keyword	O
is	O
used	O
in	O
C	B-Language
and	O
related	O
languages	O
both	O
for	O
static	B-General_Concept
variables	I-General_Concept
and	O
other	O
concepts	O
.	O
</s>
<s>
The	O
absolute	O
address	O
addressing	B-Language
mode	I-Language
can	O
only	O
be	O
used	O
with	O
static	B-General_Concept
variables	I-General_Concept
,	O
because	O
those	O
are	O
the	O
only	O
kinds	O
of	O
variables	O
whose	O
location	O
is	O
known	O
by	O
the	O
compiler	O
at	O
compile	B-Application
time	I-Application
.	O
</s>
<s>
When	O
the	O
program	O
(	O
executable	B-Application
or	O
library	B-Library
)	O
is	O
loaded	B-Operating_System
into	O
memory	O
,	O
static	B-General_Concept
variables	I-General_Concept
are	O
stored	O
in	O
the	O
data	B-General_Concept
segment	I-General_Concept
of	O
the	O
program	O
's	O
address	O
space	O
(	O
if	O
initialized	O
)	O
,	O
or	O
the	O
BSS	B-General_Concept
segment	I-General_Concept
(	O
if	O
uninitialized	O
)	O
,	O
and	O
are	O
stored	O
in	O
corresponding	O
sections	O
of	O
object	B-Application
files	I-Application
prior	O
to	O
loading	O
.	O
</s>
<s>
In	O
terms	O
of	O
scope	B-Language
and	O
extent	O
,	O
static	B-General_Concept
variables	I-General_Concept
have	O
extent	O
the	O
entire	O
run	O
of	O
the	O
program	O
,	O
but	O
may	O
have	O
more	O
limited	O
scope	B-Language
.	O
</s>
<s>
A	O
basic	O
distinction	O
is	O
between	O
a	O
static	O
global	O
variable	O
,	O
which	O
has	O
global	O
scope	B-Language
and	O
thus	O
is	O
in	O
context	O
throughout	O
the	O
program	O
,	O
and	O
a	O
static	O
local	O
variable	O
,	O
which	O
has	O
local	O
scope	B-Language
.	O
</s>
<s>
A	O
static	B-General_Concept
variable	I-General_Concept
may	O
also	O
have	O
module	O
scope	B-Language
or	O
some	O
variant	O
,	O
such	O
as	O
internal	B-Language
linkage	I-Language
in	O
C	B-Language
,	O
which	O
is	O
a	O
form	O
of	O
file	O
scope	B-Language
or	O
module	O
scope	B-Language
.	O
</s>
<s>
An	O
example	O
of	O
a	O
static	O
local	O
variable	O
in	O
C	B-Language
:	O
</s>
<s>
In	O
object-oriented	B-Language
programming	I-Language
,	O
there	O
is	O
also	O
the	O
concept	O
of	O
a	O
static	O
member	B-Application
variable	I-Application
,	O
which	O
is	O
a	O
"	O
class	B-Application
variable	I-Application
"	O
of	O
a	O
statically	O
defined	O
class	O
,	O
i.e.	O
,	O
a	O
member	B-Application
variable	I-Application
of	O
a	O
given	O
class	O
which	O
is	O
shared	O
across	O
all	O
instances	O
(	O
objects	O
)	O
,	O
and	O
is	O
accessible	O
as	O
a	O
member	B-Application
variable	I-Application
of	O
these	O
objects	O
.	O
</s>
<s>
A	O
class	B-Application
variable	I-Application
of	O
a	O
dynamically	O
defined	O
class	O
,	O
in	O
languages	O
where	O
classes	O
can	O
be	O
defined	O
at	O
run	B-Library
time	I-Library
,	O
is	O
allocated	B-General_Concept
when	O
the	O
class	O
is	O
defined	O
and	O
is	O
not	O
static	O
.	O
</s>
<s>
Object	O
constants	O
known	O
at	O
compile-time	B-Application
,	O
such	O
as	O
string	B-Language
literals	I-Language
,	O
are	O
usually	O
allocated	B-General_Concept
statically	O
.	O
</s>
<s>
In	O
object-oriented	B-Language
programming	I-Language
,	O
the	O
virtual	B-Language
method	I-Language
tables	I-Language
of	O
classes	O
are	O
usually	O
allocated	B-General_Concept
statically	O
.	O
</s>
<s>
A	O
statically	O
defined	O
value	O
can	O
also	O
be	O
global	O
in	O
its	O
scope	B-Language
ensuring	O
the	O
same	O
immutable	B-Application
value	I-Application
is	O
used	O
throughout	O
a	O
run	O
for	O
consistency	O
.	O
</s>
