0

Can anyone plz explain in more better way that what is multidimensional arrays

12th Jun 2017, 4:20 AM
Bobby Daywalker
Bobby Daywalker - avatar
3 Answers
+ 4
Multidimensional arrays are arrays stored inside arrays... To access an item from an array, you use an index: array[index], as an array is a list of indexed values. If you define a list (array) of arrays, each item of the outside array is an array, which you cab access its items: value stored in array[index] is an array, so you can access it with a second dimension/index: array[index][subindex] ^^
12th Jun 2017, 4:37 AM
visph
visph - avatar
0
If u wanna make a tbl consists of just one row and this row contains number of elements , u can make it as follow : name of the tbl [ number of elements ] = the value of elements 1- when we name the tbl we just begin by the type of data and in our example suppose it is of the type integers or (int) then we put the name of the tbl and suppose it is ( Arr ) 2- suppose we have a 5 elements in out tbl and this is called the size of the tbl 3- suppose that the values of the 5 elements were 11 , 15 , 55, 800, 555 now we can make the table or the array by a code of declaring it as follows : int Arr [ 5 ] = { 11 , 15 , 55, 800, 555 } ; in the right hand side are the elements of the tbl and they are 5 elements and every element has its position in the array , the positions are called Index of the array and it begins by 0 so: Arr[0] = 11 Arr[1] = 15 .....etc . +++ now we can say that if we wanna to make tbl of just one row we call it one-dimensional array +++ now suppose we wanna make a tbl of 2 rows and every row contain 3 elements .... we just call it an array of tow dimensional 2 × 3 as it has 2 rows and 3 columns ...and the code will be : ; int x[2][3] = { {2, 3, 4}, // 1st row {8, 9, 10} // 2nd row }; Also the code ca,n be written as follows : int x[2][3] = {{2, 3, 4}, {8, 9, 10}}; here we can say the rows have its index begins by 0 , and also columns have its index ...so the element in row 1 and column 2 - for example can be accessed as follows : x[0][1] = 3 as fist row index's is 0 and second column index's is 1 another example : x[1][2] = 10 as 1 refers to second row , while 2 refers to third column +++ Generally speaking : If we wanna make a tbl of n rows and m columns we have got here a multidimensional,arrays of n × m ... and any element in it has the position : Arr[n-1][m-1]
13th Jun 2017, 3:41 PM
Sherif Ashry
Sherif Ashry - avatar