3 Arrays

Arrays are relatively easy to handle because each element in an array must be of the same type. Let us consider the following declaration in C:

T arr[100];

The size of this array is sizeof(T)*100 because there are exactly 100 elements, and each is of type T. The calculation of the address of element i can be computed as follows:

(char*)&arr[i] == ((char*)arr+i*sizeof(T))