#include<iostream>
using namespace std;
int main()
{
int ia[3][4] = {1,2,3,4,5,6,7,8,9,10,11,12};
for (auto p = ia; p != ia + 3; p++) {
for (auto q = *p; q != *p + 4; q++)
cout << *q << ' ';
cout << endl;
}
int ib[3][4] = { 2,4,6,8,10,12,14,16,18,20,22,24 };
for (auto p = begin(ib); p != end(ib); p++)
{
for (auto q = begin(*p); q != end(*p); q++)
cout << *q << ' ';
cout << endl;
}
return 0;
}
ia是用的指针,ib用的迭代器。