Algorithm for computing address of an array
element
Row Major Order
- ? What is the address of a particular
element
- Base address is known
- Size of element is known
- Can compute the number of elements per
row
- From the number of elements per row
and the size of each element, we can compute the size of a row
- We know the row number and the column
number of the element whose address we want to find
- From the row number of the particular
element we can compute the number of rows to “skip” over.
- From the column number of the
particular element we can compute the number of columns to “skip” over