Answer
The address of the entry in the fifth row and seventh column:
1. When each entry requires two memory cells: 26 (base 10)
2. When each entry requires three memory cells: 64 (base 10)
Work Step by Step
Given:
- Array dimensions: 6 rows, 8 columns
- Array stored in row-major order
- Each entry in the array requires two memory cells initially, and then three memory cells
1. When each entry requires two memory cells:
- Total number of entries in the array = 6 rows * 8 columns = 48 entries
- Size of each entry = 2 memory cells
- Address of the array starting point = -50 (base 10)
- Address of the entry in the fifth row and seventh column:
- Row index = 5 - 1 = 4 (index starts from 0)
- Column index = 7 - 1 = 6 (index starts from 0)
- Address = Starting address + (Row index * Number of columns + Column index) * Size of each entry
= -50 + (4 * 8 + 6) * 2
= -50 + (38 * 2)
= -50 + 76
= 26 (base 10)
2. When each entry requires three memory cells:
- Size of each entry = 3 memory cells
- Using the same formula as above:
- Address = Starting address + (Row index * Number of columns + Column index) * Size of each entry
= -50 + (4 * 8 + 6) * 3
= -50 + (38 * 3)
= -50 + 114
= 64 (base 10)