In cases where the memory is contiguous, would it be possible to just use another pointer to access the elements?
For example:
1 2 3 4 5 6 7 8 9
int md[10][10] = { /* initialize elements */ };
int * p = &md[0][0];
for( int i = 0; i < 100; ++i )
{
cout << *p++ << endl;
// or even:
cout << p[i] << endl;
}
EDIT: This worked on my machine using GCC. I'm not sure that all implementations would store the array data contiguously. This might not be portable.