answersLogoWhite

0


Best Answer

Generally speaking, a static array is a fixed-length array while a dynamic array is a variable-length array.

However, we prefer the terms fixed-length and variable-length because static objects are objects that are allocated in static memory at compile time, which means they have a fixed offset address (the offset remains the same for each execution and will not change at runtime). Dynamic objects, on the other hand, are allocated and destroyed at runtime, which means they have dynamic addresses; each time the object is instantiated we cannot guarantee it resides at the same address.

To put it another way, all static arrays must be fixed-length arrays, but not all fixed-length arrays must be static arrays. We can allocate a fixed-length array in static memory (in which case it is also a static array), but we can also allocate a fixed-length array on the call stack or on the heap, in which case we can potentially create more than one instance of that array, each with its own unique address.

Consider a recursive function that instantiates a local (non-static) fixed-length array: each instance of that function would instantiate a new instance of that array, each with its own unique address. Similarly with multi-threaded applications: each thread has its own call stack, thus we could potentially have multiple threads invoking the same function and thus instantiating multiple instances of the same array in different call stacks, each with its own unique address. And if we allocate a fixed-length array on the heap, we have no guarantee where that array will be allocated.

So whenever we speak of static or dynamic allocations, remember that we are specifically referring to the address (or at least the offset address). Dynamic addresses can change at runtime, static addresses cannot. Although the physical address of a static object can change between executions, its offset address (relative to the start of the static data segment) can never change -- not without recompiling the executable.

User Avatar

Wiki User

6y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is static array and dynamic array in visual basic?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Program to print all the even numbers of an array in visual basic?

find even number in array


What does Visual Basic utilize to generate vigorous and dynamic application?

GUI


What is visual basic control?

Visual Basic Controls work on Visual Studio for Visual Basic and Applications that made by Visual Basic.


Explain how Multidimensional Arrays are used in a Visual Basic application?

Creating a Visual Basic Multidimensional Array Declaring a multidimensional array requires both the number of rows and columns to be defined when the array is created. As with standard arrays, multidimensional arrays are declared using the Dimkeyword: Dim strBooks(4, 2) As String The above Visual Basic code excerpt creates a two dimensional String array of 5 rows and 2 columns. Assigning Values to Multidimensional Array Values are assigned to array elements by specifying the index into each dimension. For example, in a two dimensional array, 0, 0 will references the element in the first column of the first row of the array. The following code initializes each element of our array: Dim strBooks(4, 1) As String strBooks (0, 0) = "Learning Visual Basic" strBooks (0, 1) = "John Smith" strBooks (1, 0) = "Visual Basic in 1 Week" strBooks (1, 1) = "Bill White" strBooks (2, 0) = "Everything about Visual Basic" strBooks (2, 1) = "Mary Green" strBooks (3, 0) = "Programming Made Easy" strBooks (3, 1) = "Mark Wilson" strBooks (4, 0) = "Visual Basic 101" strBooks (4, 1) = "Alan Woods" The above example creates a two dimensional array of 5 rows (remember that indexing starts at 0 so this array have elements from 0 to 4 inclusive) and two columns. Column 1 is the book title and column 2 the author.Answerer 1 Multidimensional arrays are used as follows:-Dim a(m,n) as integerfor putting valuefor i = 1 to mfor j = 1 to na(i , j) = val(inputbox("Enter the value"))s = s & a(i , j) & " "next js = s & vbcrlfnext i


The year of invention of visual basic?

Visual Basic was started in 1991.

Related questions

What static array and dynamic array in visual basic?

Generally speaking, a static array is a fixed-length array while a dynamic array is a variable-length array. However, we prefer the terms fixed-length and variable-length because static objects are objects that are allocated in static memory at compile time, which means they have a fixed offset address (the offset remains the same for each execution and will not change at runtime). Dynamic objects, on the other hand, are allocated and destroyed at runtime, which means they have dynamic addresses; each time the object is instantiated we cannot guarantee it resides at the same address. To put it another way, all static arrays must be fixed-length arrays, but not all fixed-length arrays must be static arrays. We can allocate a fixed-length array in static memory (in which case it is also a static array), but we can also allocate a fixed-length array on the call stack or on the heap, in which case we can potentially create more than one instance of that array, each with its own unique address. Consider a recursive function that instantiates a local (non-static) fixed-length array: each instance of that function would instantiate a new instance of that array, each with its own unique address. Similarly with multi-threaded applications: each thread has its own call stack, thus we could potentially have multiple threads invoking the same function and thus instantiating multiple instances of the same array in different call stacks, each with its own unique address. And if we allocate a fixed-length array on the heap, we have no guarantee where that array will be allocated. So whenever we speak of static or dynamic allocations, remember that we are specifically referring to the address (or at least the offset address). Dynamic addresses can change at runtime, static addresses cannot. Although the physical address of a static object can change between executions, its offset address (relative to the start of the static data segment) can never change -- not without recompiling the executable.


Is Special Types of test are Static Testing or Dynamic testing?

static and dynamic testing are basic types of testing


What are the 2 basic forms of semiconductor RAM?

Static, and Dynamic.


Program to print all the even numbers of an array in visual basic?

find even number in array


What does Visual Basic utilize to generate vigorous and dynamic application?

GUI


What is the Advantage of dynamic ip over a static ip?

The basic idea of dynamic IP addresses is to simplify network administration.The basic idea of dynamic IP addresses is to simplify network administration.The basic idea of dynamic IP addresses is to simplify network administration.The basic idea of dynamic IP addresses is to simplify network administration.


What type of wheel balance is measured with the wheel stationary?

That is static balance, basic, but not as important as dynamic balance.


What is visual basic control?

Visual Basic Controls work on Visual Studio for Visual Basic and Applications that made by Visual Basic.


Explain how Multidimensional Arrays are used in a Visual Basic application?

Creating a Visual Basic Multidimensional Array Declaring a multidimensional array requires both the number of rows and columns to be defined when the array is created. As with standard arrays, multidimensional arrays are declared using the Dimkeyword: Dim strBooks(4, 2) As String The above Visual Basic code excerpt creates a two dimensional String array of 5 rows and 2 columns. Assigning Values to Multidimensional Array Values are assigned to array elements by specifying the index into each dimension. For example, in a two dimensional array, 0, 0 will references the element in the first column of the first row of the array. The following code initializes each element of our array: Dim strBooks(4, 1) As String strBooks (0, 0) = "Learning Visual Basic" strBooks (0, 1) = "John Smith" strBooks (1, 0) = "Visual Basic in 1 Week" strBooks (1, 1) = "Bill White" strBooks (2, 0) = "Everything about Visual Basic" strBooks (2, 1) = "Mary Green" strBooks (3, 0) = "Programming Made Easy" strBooks (3, 1) = "Mark Wilson" strBooks (4, 0) = "Visual Basic 101" strBooks (4, 1) = "Alan Woods" The above example creates a two dimensional array of 5 rows (remember that indexing starts at 0 so this array have elements from 0 to 4 inclusive) and two columns. Column 1 is the book title and column 2 the author.Answerer 1 Multidimensional arrays are used as follows:-Dim a(m,n) as integerfor putting valuefor i = 1 to mfor j = 1 to na(i , j) = val(inputbox("Enter the value"))s = s & a(i , j) & " "next js = s & vbcrlfnext i


What are the basic movement and basic skills in dancing?

14 basic movementsHopping Skipping Galloping Running Jumping Catching Underhand Throwing Overhand Throwing Rolling Kicking Static Balance Bouncing Dynamic Balance Striking


What are Visual Basic features?

Important Features of Visual Basic (VB)Full set of objects - you 'draw' the applicationLots of icons and pictures for your useResponse to mouse and keyboard actionsClipboard and printer accessFull array of mathematical, string handling, and graphics functionsCan handle fixed and dynamic variable and control arraysSequential and random access file supportUseful debugger and error-handling facilitiesPowerful database access toolsActiveX supportPackage & Deployment Wizard makes distributing your applications simple


The year of invention of visual basic?

Visual Basic was started in 1991.