Knowee
Questions
Features
Study Tools

Interpret where the elements of an array LA are stored, if the base address of LA is 320 & LB =0Assume that int(s) are stored in 4 bytes and double(s) in 8 bytes.a. double LA[12]

Question

Interpret where the elements of an array LA are stored, if the base address of LA is 320 & LB =0Assume that int(s) are stored in 4 bytes and double(s) in 8 bytes.a. double LA[12]

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

Solution

The array LA is of type double, which means each element in the array occupies 8 bytes (since a double is stored in 8 bytes).

If the base address of LA is 320, then the elements of LA are stored in memory at the following addresses:

  • LA[0] is stored at base address 320.
  • LA[1] is stored at base address 320 + 1*8 = 328.
  • LA[2] is stored at base address 320 + 2*8 = 336.
  • LA[3] is stored at base address 320 + 3*8 = 344.
  • And so on...

So, in general, the i-th element of the array LA (LA[i]) is stored at the address 320 + i*8.

This is because arrays in C are contiguous blocks of memory. The address of the i-th element is calculated by adding the product of the size of the data type and the index to the base address.

This problem has been solved

Similar Questions

Interpret where the elements of an array LA are stored, if the base address of LA is 320 & LB =0Assume that int(s) are stored in 4 bytes and double(s) in 8 bytes.a. double LA[12]

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

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

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

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]?

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.