What Is Dynamic Array In VB And How It Is Used?
Array whose size can be changed at runtime is called dynamic array. The dynamic array is also sometimes called as redimmable array. This type of array is used to store a list of values which can shrink or extend during execution of program. Thus dynamic arrays are more flexible than the static/fixed size arrays. Unlike the fixed size array, the size of the dynamic array is not specified at the time of declaration as: Dim dynamicArray() as integer Where ‘dynamicArray’ is name of a dynamic array of integer type. The size of dynamic array is set by using a keyword ‘Redim’. The memory is allocated for array when the Redim is encountered (because the above declaration does not allocate memory space for the dynamic array). The Redim is used as: Redim dynamicArray(5) This statement allocates the memory for 6 array elements (if lower bound is 0). Otherwise we can specify both the upper bound and lower bound of array by using Redim as: Redim dynamicArray(1 to 5) The size of dynamic array can be
Related Questions
- Talking about capacity, I’ve heard the terms STATIC, ROLLOVER and DYNAMIC being used. Which rating should influence my Dock Leveler selection?
- How many monitors should be used in order to calculate the dynamic thermal rating of an overhead line?
- Can chat system be used with dynamic and secure web pages? Does it work properly on Linux hosting?