How are arrays used in a high level programming language:
|
The array elements of an array are stored contiguously in memory:
Notice: there are no gaps between consecutive array elements
Notice that each array element occupies the same number of bytes of memory !!!
A byte (typed) array uses 1 byte to store each of its array element
How a byte typed array is stored in memory:
Remember: There are no gaps between array elements !
A short (typed) array uses 2 bytes to store each of its array element
How a short typed array is stored in memory:
Remember: There are no gaps between array elements !
A int (typed) array uses 4 bytes to store each of its array element
How an int typed array is stored in memory:
Remember: There are no gaps between array elements !
|
|
|
|
|
|
Dynamic arrays are not the norm in high level programming languages
|
|
We will use static arrays in CS255 !