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 which are static
only have their initial value
assigned once during the program’s execution. Thus, they can be preferable over initialized
auto objects which are assigned a value every time the block in they are defined begins
execution.
All static
variables which are also specified as
const
will be stored in program memory.