Write about Multi Dimensional Arrays?

C allows arrays of 3 or more dimensions. The exact limit is determined by the compiler. The general form of a Multi Dimensional Arrays is:

Type arrayname [s1][s2][s3]……….[sn];

Where Si is the size of the i th dimension.

Ex : int survey [3][5][12];

        float table [5][4][5][3];

Survey is a 3-Dimensional  array declared to contains 180 integer type elements similarly table is a 4-Dimensional  array contain 300 elements of floating point type.

The array survey may represent a survey data of rainfall during the last 3 years from January to December in 5 cities.

If the first index denotes year, the second city and the third month, then the element

survey [2][3][10];

Denotes the rainfall in the month of October during the second year in city -3.

Remember that a three-Dimensional  array can be represented as a series of two Dimensional arrays of shown below.

multidimensional arrays


ANSI c does not specify array limit for array di however, most compiler per 7 to 10 dis. Some allow even more. 

Related

C Language 8989095480642003050

Post a Comment

emo-but-icon

item