in programming there is often such tasks walk through in multi dimensional array (for simplify let take two dimensional) i need indexes of elements in two dimensional array like
left to right bottom to up and vice versa and so on please give me a few examples
in programming there is often such tasks walk through in multi dimensional array (for
Share
The length of an array
arr, in Java, is alwaysarr.length. In Java, multidimensional arrays are nothing but array of arrays, so you can successively take the.lengthof any “sub-arrays”.The above prints:
To represent matrices, it’s best to attach to the data structure (arrays or not) two indices
MandN, which is the dimension of the matrix, and iterate on indices in terms ofMandNinstead of array.length. This higher abstraction would lead to better readability.See also