This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ays in C are one means of aggregating scalar data into larger data types. C uses a particularly simple implementation of arrays, and hence the translation into machine code is fairly straightforward. One unusual feature of C is that one can generate pointers to elements within arrays and perform arithmetic with these 3.8. ARRAY ALLOCATION AND ACCESS
pointers. These are translated into address computations in assembly code. 143 Optimizing compilers are particularly good at simplifying the address computations used by array indexing. This can make the correspondence between the C code and its translation into machine code somewhat difﬁcult to decipher. 3.8.1 Basic Principles
For data type Ì and integer constant Æ , the declaration Ì A[Æ ]; has two effects. First, it allocates a contiguous region of Ä ¡ Æ bytes in memory, where Ä is the size (in bytes) of data type Ì . Let us denote the starting location as ÜA . Second, it introduces an identiﬁer A that can be used as a pointer to th...
View Full Document