![]() |
![]() |
![]() |
![]() |
![]() |
|
Alternatively, if an array is to hold integers of type int, most
implementations of C would allocate 4 bytes per integer:
0 1 2 <-- Array
| | | index
v v v
--------------- --------------- --------------- -----------
--*---*---*---*---*---*---*---*---*---*---*---*---*---*---*-
| | | | | | | | | | | | | | |
-*---*---*---*---*---*---*---*---*---*---*---*---*---*---*--
^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | |
88 90 92 94 96 98 102 104
In this example, the first integer in the array appears at memory address 88, the second appears at 92, and the third appears at 96.