#include using namespace std; const int n = 10; // We pass a matrix as a linear array. This is general, but the // implicit pointer arithmetic done by calls such as m[i][j] needs now // to be done by hand. void display(int m[], int size) { for (int i = 0; i < size; i++) { cout << "\n"; for (int j = 0; j < size; j++) cout << *(m+i*size+j) << "\t"; // *(m+i*size+j) instead of m[i][j] } cout << "\n"; } int main () { int mm[n][n]; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) mm[i][j] = i+j; display((int*)mm,n); }