The simplest form of the multidimensional array is the two-dimensional array. A two-dimensional array is essentially, an array of one-dimensional arrays. To declare a two-dimensional integer array "S" of size 10,20, you would write.
int s[10][20];
Two-dimensional arrays are stored in a row-column matrix, where the first index indicates the row and the second indicates the column. This means that the rightmost index changes more quickly than the leftmost when accessing the elements in the array in the order in which they are actually stored in memory.
Suppose, you want to access element located at 3'rd row and 5'th column of the two dimensional array "S", store the value in a integer variable var then the statement would be like this :
Suppose, you want to access element located at 3'rd row and 5'th column of the two dimensional array "S", store the value in a integer variable var then the statement would be like this :
int var = s[2][4]; /* As Array index start from 0, 2 indicates 3'rd Row and 4 indicates 5'th Column*/
No comments:
Post a Comment