Structured Data Type: Arrays
Structured Data Type: Arrays
Structured Data Type: Arrays
STRUCTURED DATA
TYPE
ARRAYS
INTRODUCTION
An array is a collection of variables
of same type that are referenced by a
common name .
C++ allows more type of data i.e its
derived data type.(integer and floating
point).
TYPES OF ARRAYS
0 N-1
M-1
PROCESSING 2 D ARRAY
We use nested loops to process 2 d array. one
loop process the rows and another columns .If
outer loops is for rows and inner loop for columns
then each row index, all columns are processed
and then the same process is repeated.
int A [2][3];
int i,j;
for(i=1;i<=2;++i)
{
for (j=1;j <=3; ++j)
{ cout<<“enter element”;
cin >> A [ i ] [ j ] ;
}
cout<<“\n”;
MEMORY REPRESENTATION
OF 2D ARRAY
Two dimension array are stored in a row
column matrix, where the first index
represents the row and second indicates the
column. This means that the second index
changes faster than first index when
accessing the elements in an array order.
The formula to calculate the total number
of bytes of two d array are:
Total bytes=no of rows *no of columns*size of base
MATRICES AS 2D ARRAYS