wpe41.gif (23084 bytes)CIS3355: Business Data Structures
Fall, 2008
 

CIS3355: Data Structure
Fall, 2002

How are strings like numeric arrays ?????

  • Like all numeric arrays, strings require  a set number of contiguous bytes of storage. In many aspects, they are the simplest of arrays, since they require only one byte of storage per element. Therefore, calculating the address of an individual element based on the offset from the base address is relatively simple.

  • Consider the C code

The declaration:

  • Reserves 5-bytes of RAM at address chararray.
  • Initialized each element of the array with a character.

We could have also written the C code as:

Which would have Exactly the same effect

 

How would this be stored in RAM   ?????

  • Assume that the base address of chararray (==&chararray[0]) is

                                                  1200  :