Knowee
Questions
Features
Study Tools

Consider a two-dimensional array C[12][6] stored in row-major order. Assume there are 3 words per memory cell, the base address of array C is 300, and the first element is C[0][0].What is the address of C[9][2]?

Question

Consider a two-dimensional array C[12][6] stored in row-major order. Assume there are 3 words per memory cell, the base address of array C is 300, and the first element is C[0][0].What is the address of C[9][2]?

🧐 Not the exact question you are looking for?Go ask a question

Solution

To find the address of C[9][2] in a two-dimensional array stored in row-major order, we need to use the formula for calculating the memory address of an element in a two-dimensional array:

Address = Base Address + ((row number * total number of columns) + column number) * size of each element

In this case, the base address is 300, the row number is 9 (since we're looking for C[9][2]), the total number of columns is 6, the column number is 2, and the size of each element is 3 (since there are 3 words per memory cell).

So, substituting these values into the formula, we get:

Address = 300 + ((9 * 6) + 2) * 3 Address = 300 + (54 + 2) * 3 Address = 300 + 56 * 3 Address = 300 + 168 Address = 468

So, the address of C[9][2] is 468.

This problem has been solved

Similar Questions

A one-dimensional array A has indices 1....75. Each element is a string and takes up three memory words. The array is stored at location 1120 decimal. The starting address of A[49] is

The elements of an array are stored successively in memory cells because#a)by this way computer can keep track only the address of the first element and theaddresses of other elements can be calculatedb) the architecture of computer memory does not allow arrays to store other than seriallyc)both of aboved) because the computer memory is linearly structurede) none of the above90. The memory address of the first element of an array is calleda) floor addressb) foundation addressc)first address#d) base addresse) the index address

Consider the following array declaration and use it to answer questions 46-49:int A[4][5][6];46. What will be the total memory in bytes that is to be reserved by the machine to store the dataitems in this array:a) 580 bytesb) 680 bytes#c) 480 bytesd) 380 bytese) 280 bytes47. If the machine is to store the data items in this array using row-major ordering, what will be theaddress location of an item located at A[2][3][5] if the base address is 200.a) 332b) 846c) 733# d) 532e) 63248. What will be the address of the same data item in question 47 above if the items in the arraywere stored using column-major ordering?a) 456b) 650#c) 656d) 556e) 532

Which of the following shows the memory address of the first element in an array?

If column-major order is used, how is the following matrix stored in memory?

1/2

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.