384 ◾ Appendix D
address, specically the address of the rst element of the array. e loca-
tion of each individual array element is calculated as an oset from the
base address of the array: the jth element has an oset of (j*ElementSize).
In a zero-based array, A[0] is thus the address of the rst element, A[1]
the address of the second element, etc. A[i] is thus associated with the
address of the i+1st element. e compiler automatically deferences the
array address so that the programmer manipulates array elements as data
rather than as addresses.
Example D3: C++ [] Overloaded for Intuitive Access
// intended use: Sequence a(SIZE);
// …
// a[index] = b;
// overloaded operator provide bounds checking
// requires #include cassert
int& ...