Question

Representation of two dimensional array in memory is -

A

Row-major

B

Column-major

C

Both (1) and (2)

D

None of these

Medium
Solution
verified
Verified by Toppr
Correct option is C)

Representation of two dimensional array in memory is row-major and column-major.

2D array has a type such as int[][] or String[][], with two pairs of square brackets. The elements of a 2D array are arranged in rows and columns, and the new operator for 2D arrays specifies both the number of rows and the number of columns. 

two-dimensional matrix a, two dimensional address space must be mapped to one-dimensional address space. In the computer's memory matrices are stored in either Row-major order or Column-major order form.

Row-major order and column-major order are methods for storing multidimensional arrays in linear storage such as random access memory.

 

solution
expand
Was this answer helpful?
upvote 0
downvote0