Memory Representation of Array
Link will be apear in 15 seconds.
Well done! you have successfully gained access to Decrypted Link.
The process to determine the address in a memory:
a) First address – base address.
b) Relative address to base address
through index function.
Example: char X[100];
Let char uses 1 location
storage.
If the base address is 1200 then the
next element is in 1201.
Index Function is written as:
Loc (X[i]) = Loc(X[0]) + i ,
i is subscript and LB = 0
§ In general, index function:
Loc (X[i]) = Loc(X[LB]) +
w*(i-LB);
where w is length of memory location
required.
For real number: 4 byte, integer: 2
byte and character: 1 byte.
§ Example:
If LB = 5, Loc(X[LB]) = 1200, and w =
4, find Loc(X[8]) ? Loc(X[8])= Loc(X[5]) + 4*(8 – 5)
= 1212