Explore BrainMass

Storing Three-dimensional Homogeneous Arrays

Describe a method for storing three-dimensional homogeneous arrays. What addressing formula would be used to locate the entry in the ith plane, jth row, and the kth column?

Solution Preview

A three dimensional array is declared in C, C++ as
int array[3][3][3];

So, there are a total of 3x3x3 = 27 elements in the array. The computer memory is flat; essentially a one dimensional array. So, in order to understand how to store a ...