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.
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.
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 ...