// passing a multidimensional array as parameter // Mikhail Nesterenko // 4/12/2013 #include using std::cin; using std::cout; using std::endl; const int width=2; void initArray(int [][width], int); void printArray(int [][width], int); int main (){ const int length=5; int a[length][width]; // declares an integer array of 5 rows and 2 columns initArray(a, length); printArray(a, length); } // initializes the arry void initArray(int b[][width], int length){ cout << "Input " << width*length << " elements: "; for(int i=0; i < length; i++) for(int j=0; j < width; j++) cin >> b[i][j]; } // output each array element's value void printArray(int c[][width],int length){ for (int i=0; i < length; i++) for (int j=0; j < width; j++) cout << "a[" << i << "][" << j << "] = " << c[i][j]<< endl; }