Showing posts with label Arrays. Show all posts
Showing posts with label Arrays. Show all posts

Arrays in VB


An array is a consecutive group of memory locations that all have the same name and the same type. To refer to a particular location or element in the array, we specify the array name and the array element position number. The Individual elements of an array are identified using an index. Arrays have upper and lower bounds and the elements have to lie within those bounds.
Each index number in an array is allocated individual memory space and therefore users must evade declaring arrays of larger size than required. We can declare an array of any of the basic data types including variant, user-defined types and object variables. The individual elements of an array are all of the same data type.

Structures and Arrays

Strutures are user defiened data types, whereas arrays are derived data types. While an array is a collection of nalogous elements elements, a structure assembles dissimilar elements under one roof. thus both arrays and structures allow several values to be treated together as a single data object.
int a[]={10,20,30,40,50}; // array are elements of the same type (int)
student stud1={2, "Rahul",12, 67.00, 'A'}; // structure elements are of different types
Arrays of structures
Using arrays of structures is similar to using arrays of anything else. When structures are present within an array you have an array of structures. To declare an array of structures, LEARN MORE>>

Multidimensional Arrays

An array that has more than one subscrpt is known as a multidimensional array. Multidimensional arrays can be visualizes as arrays of arrays.

A two-dimensional array is the simplest form of a multidimensional array. In a two-dimensional array, two subscripts are enclosed in square brackets. The rirst subscript designates the row and the second subscript designates the column. A two-dimensional array is used for table processing or matrix manipulation.
Array Declaration
The general form of a two-dimensional array declaration in C++ is:
type array-name[rows][coloumns];
LEARN MORE>>

Structured Data Type: Arrays

Arrays are a series of elements (variables) of the same type placed consecutively in memory that can be individually referenced by adding an index to a unique name.
An Array declaration is very similar to a variable declaration. For eg:
float annual_temp[10];
This will cause the compiler to allocate space for 10 consecutive float variables in memory. The number of elements in an array must be fixed at compile time. The elements of an array are ordered by the index. Array index numbering starts from zero. LEARN MORE>>