O'Reilly logo

Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition by Harvey M. Deitel - Deitel & Associates, Inc., Paul J. Deitel - Deitel & Associates, Inc.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8.4. Examples Using Arrays

This section presents several examples that demonstrate the declaration, allocation and initialization of arrays, as well as various common manipulations of array elements. The examples in this section use arrays that contain elements of type Integer.

8.4.1. Allocating an Array

The program in Fig. 8.2 uses the New operator to allocate an array of 10 Integer elements, which are initially zero (the default value for Integer variables). The program displays the array elements in tabular format in a console window.

Figure 8.2. Creating an array.
						1
						' Fig. 8.2: CreateArray.vb
						2
						' Declaring and allocating  an array.
						3
						Module CreateArray
 4
						Sub Main()
 5
						Dim array As Integer() ' declare array variable
						6
						7
						' allocate memory for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required