<P> Note that BCPL defined a "dynamic data item" for what is now called an automatic variable (local, stack - allocated), not for heap - allocated objects, which is the current use of the term dynamic allocation . </P> <P> The static keyword is used in C and related languages both for static variables and other concepts . </P> <P> The absolute address addressing mode can only be used with static variables, because those are the only kinds of variables whose location is known by the compiler at compile time . When the program (executable or library) is loaded into memory, static variables are stored in the data segment of the program's address space (if initialized), or the BSS segment (if uninitialized), and are stored in corresponding sections of object files prior to loading . </P> <P> In terms of scope and extent, static variables have extent the entire run of the program, but may have more limited scope . A basic distinction is between a static global variable, which has global scope and thus is in context throughout 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 . </P>

Where are local non-static variables stored in an executable file