Next: , Up: Arrays


4.1 Dense arrays

Dense arrays, which may be multidimensional, have the constraint that each dimension is precisely covered by a set of contiguous indices, expressible in the form [a..x][b..y]. The lower index of each dimension need not start at 0.

The syntax for dense arrays is similar to that of C declarations, with a few extensions discussed in Array Declarations. The following examples are all dense declarations, resulting in densely packed collections:

Dense array declarations:

     pint y[2][2];      // y is dense 2D
     pint N = 5;
     int bar[4][5][N];  // bar is dense 3D
     int z[2..6][3];    // z is dense 2D