Computer Science, asked by pallaviaher87672, 19 days ago

How to represent 2D-array in memory (Row major and column major)​

Answers

Answered by RohitVaishnavv
0

Answer:

main syntax used

int arr[max_rows][max_columns] = {elements in rows/column};

Explanation:

to represent 2D array in memory we use the syntax as:-

int arr[max_rows][max_columns] = {elements in rows/column};

here,

int is the keyword used

arr is used to declare the name of array

along with we need to declare maximum number of rows and columns we need

In row major, all the rows are stored into the memory continuously

firstly, the 1st row of array is completely stored into the memory, then we move on the 2nd row and so on till the last row.

In column major, all the columns are stored into the memory continuously

firstly, the 1st column of array is completely stored into the memory, then we move on the 2nd column and so on till the last column.

Similar questions