/* array2.h - Dealing with a one-dimensional array as if it were
 *            a two dimensional array.
 */

#ifndef ARRAY2_H_
#define ARRAY2_H_

class Array2{
   int *p;
  int ncolumns; // Number of columns in a row
public:
  // Constructor
  Array2(int a[], int columns)
    {
      p = a;
      ncolumns = columns;
    }

  // Operator to allow us to use the convenient notation
  // r[row][column]
  int * operator[](int row) {
    return (p + row*ncolumns);
  }
};

#endif

