5.4.2.1.2 Static Objects
All static
objects have static storage duration, even
local static
objects, defined inside a function and which have a scope
limited to that function. Even local static
objects can be referenced by a
pointer and are guaranteed to retain their value between calls to the function in which
they are defined, unless explicitly modified via a pointer.
Objects that are static
only have their initial value
assigned once during the program’s execution. Thus, they generate more efficient code than
initialized auto
objects, which are assigned a value every time the block
in which they are defined begins execution. Unlike auto
objects, however,
initializers for static
objects must be constant expressions.
All static
variables that are also specified as
const
will be stored in program memory.