X
ONLINE BOOKING
BOOK NOW
OFFLINE BOOKING
Call or WhatsApp 7993732682 (WhatsApp Now), 9177341827 (WhatsApp Now)
X
• Home
• Legal Disclaimer
• Terms & Conditions
• Return Policy
• Need any help?? write to us at

support@engineershub.in

X
Go Back
Go Back
Go Back
OR
Fill Up a Simple Form
Fill all the below details correctly and click on Next
Go Back
Explain how two-dimensional arrays can be used to represent matrices? (OR) Define an array and how the memory is allocated for a 2D array? - EngineersHub
Go Back
Question
Arunbavu Arun
1 year ago
1 year ago

These are stored in the memory as given below.

1) Row-Major order Implementation

2) Column-Major order Implementation

In Row-Major Implementation of the arrays, the arrays are stored in the memory in terms of the row design, i.e. first the first row of the array is stored in the memory then second, and so on.

Suppose we have an array named arr having 3 rows and 3 columns then it can be stored in the memory in the following manner :

int arr[3][3];

Thus an array of 3*3 can be declared as follows :

arr[3][3] = { 1, 2, 3,

4, 5, 6,

7, 8, 9 };

and it will be represented in the memory with row-major implementation as follows :

In Column-Major Implementation of the arrays, the arrays are stored in the memory in the term of the column design, i.e. the first column of the array is stored in the memory than the second, and so on. By taking the above eg. we can show it as follows :

arr[3][3] = { 1, 2, 3,

4, 5, 6,

7, 8, 9 };

and it will be represented in the memory with column-major implementation as follows :

Two-dimensional arrays of variable length

An array consisting of two subscripts is known as a two-dimensional array. These are often known as an array of the array. In two-dimensional arrays, the array is divided into rows and columns,.

These are well suited to handle the table of data. In a 2-D array, we can declare an array as :

Declaration:-

Syntax: data_type array_name[row_size][column_size];

Ex: int arr[3][3] ;

Where first index value shows the number of the rows and the second index value shows the no. of the columns in the array.

These are stored in the memory as given below.

Initialization:-

To initialize values for variable-length arrays we can use scanf statement and loop constructs.

Ex:-

for ( i=0 ; i<3; i++ )

for( j=0;j<3;j++ )

scanf( “ %d ”,&arr[i][j] );

### Users Joined

Pranathi
2 hours ago
p a V a n
2 hours ago
Sheri
2 hours ago
hussain basha
5 hours ago
Koushik Narige
22 hours ago
X
Explain how two-dimensional arrays can be used to represent matrices? (OR) Define an array and how the memory is allocated for a 2D array?
X
Explain how two-dimensional arrays can be used to represent matrices? (OR) Define an array and how the memory is allocated for a 2D array?

These are stored in the memory as given below.

1) Row-Major order Implementation

2) Column-Major order Implementation

In Row-Major Implementation of the arrays, the arrays are stored in the memory in terms of the row design, i.e. first the first row of the array is stored in the memory then second, and so on.

Suppose we have an array named arr having 3 rows and 3 columns then it can be stored in the memory in the following manner :

int arr[3][3];

Thus an array of 3*3 can be declared as follows :

arr[3][3] = { 1, 2, 3,

4, 5, 6,

7, 8, 9 };

and it will be represented in the memory with row-major implementation as follows :

In Column-Major Implementation of the arrays, the arrays are stored in the memory in the term of the column design, i.e. the first column of the array is stored in the memory than the second, and so on. By taking the above eg. we can show it as follows :

arr[3][3] = { 1, 2, 3,

4, 5, 6,

7, 8, 9 };

and it will be represented in the memory with column-major implementation as follows :

Two-dimensional arrays of variable length

An array consisting of two subscripts is known as a two-dimensional array. These are often known as an array of the array. In two-dimensional arrays, the array is divided into rows and columns,.

These are well suited to handle the table of data. In a 2-D array, we can declare an array as :

Declaration:-

Syntax: data_type array_name[row_size][column_size];

Ex: int arr[3][3] ;

Where first index value shows the number of the rows and the second index value shows the no. of the columns in the array.

These are stored in the memory as given below.

Initialization:-

To initialize values for variable-length arrays we can use scanf statement and loop constructs.

Ex:-

for ( i=0 ; i<3; i++ )

for( j=0;j<3;j++ )

scanf( “ %d ”,&arr[i][j] );

x