CSCI 2400 Lecture 8: Slides 08
Document Summary
Contiguously allocated region of l* sizeof(t) bytes in memory. Array of data type t and length l. Identifier a can be used as a pointer to array element 0: type t* Declaration zip_dig cmu equivalent to int cmu[5] . Example arrays were allocated in successive 20 byte blocks . Register %rdi contains starting address of array. Variale pgh: array of 4 elements, allocated contiguously. Each element is an array of 5 int"s, allocated contiguously. A[i] is array of c elements of type t. Starting address a + i * (c * sizeof(t)) A[ i ][ j ] is element of type t, which requires k bytes. Address a + i * (c*k) + j*k. = a + (i * c + j) * k. Each pointer points to array of int"s. Accesses looks similar in c, but address computations very different: Big enough to hold all of the fields. Even if another ordering could yield a more compact representation.