Return to The Concepts of Binding and Binding Times

Static Storage Binding:

Static variables are bound to memory cells before program execution begins
and remain bound to those same memory cells until program execution terminates.
e.g. globally accessible variables  (FORTRAN I, II and IV)
e.g. C, C++, and Java include the static specifier on local variable definition
e.g. Pascal does not provide static variables.
Advantage:  efficient (direct addressing), history-sensitive subprogram support
Disadvantage:  lack of flexibility, no recursion supported

//extract a character from the string.
//static will remember last position.
char lexical()
{
 static int position = -1;
 position = position + 1;
 return text[position];
}
//Java Programming
public class Stuff {
    
    // Set count to zero initially.
    static int count = 0;
    
    public Stuff() {
        
        // Every time the constructor runs, increment count.
        count = count + 1;
        
        // Display count.
        System.out.println("Created object number: " + count);
    }
}
public class Application {
    
    public static void main(String[] args) {
        Stuff stuff1 = new Stuff();
        Stuff stuff2 = new Stuff();
        Stuff stuff3 = new Stuff();
    }

}

Go To Stack-Dynamic Storage Binding
Go To Explicit Heap-Dynamic Storage Binding
Go To Implicit Heap-Dynamic Storage Binding