ARRAY :
1] Array is the collective name given to a group of similar quantity or variables that are stored in consecutive memory locations.
2] Each member/element of a group is referred by its position in the group.array is also known as subscripted value or indexed variable.
3] There are different types of array such as one, two and multi dimensional arrays.
One Diamensional Array :
An array declared with single subscript is called one dimensional array follows:
Declaration Data_type Array_name[size];
Ex: int employee[10];
Initialization: The general form of initialization of one dimensional arrays is:
Data_type Array_name[size]={list of values};
Ex: int employee[5] ={88,05,93,70};
Two Dimensional Array:
An array declared with two subscript is called two dimensional arrays is:
Declaration: Data_type Array_name[rowsize][col size];
Ex: int Matrix [3][4];
Initialization: The general form of initialization of two dimensional arrays is:
Data_type Array_name [rowsize][colsize]={list of values};
Ex: int Matrix[3][2] = {93,70,88,55};
Multi-Dimensional Array :
An array declared with two or more subscript is called multi-dimensional array.
Declaration : Data_type Array_name [D1][D2][D3]...;
Ex: int Matrix[3][4];
Initialization: The general form of initialization of multi dimentional arrays is:
Declaration : Data_type Array_name [D1][D2][D3]...={list of values};
No comments:
Post a Comment