vrijdag 15 juni 2007

Static Binding & Dynamic Binding & Dynamic Array

If you write a program that might or might not use an array, depending on the information given when the program runs, if you create an array by declaring it, the space is allocated when the program is compiled.
Wheter or not the program finally uses the array, the array is there, using up memory. Allocating the array at compile time is called STATIC BINDING.
meaning that the array is built in the program at compile time. But with new, you can create an array during runtime if you need it, and skip creating the array if you don't need it. Or you can select an array size after the program is running. This is called DYNAMIC BINDING, meaning that the array is created while the program is running. Such an array is called a DYNAMIC ARRAY.
With static binding, you must specify the array size when you write the program. With dynamic binding, the program can decide on an array size while the program runs.

Geen opmerkingen: