1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#include <iostream>
using namespace std;
void print(int* matrix[], const int& rows, const int& cols)
{
for (int n = 0; n < rows*cols; ++n)
{
cout << (*matrix)[n] << endl;
}
}
int main()
{
const int ROWS(2), COLS(5);
int m[ROWS][COLS] = {{1,2,3,4,5},
{10,20,30,40,50}};
int* pMatrix[ROWS];
*pMatrix = m[0];
print(pMatrix, ROWS, COLS);
return 0;
}
|