二维
#include <iostream>
using namespace std;
int main()
{
float anchors[5][4] = {0};
//输出
for (float(&p)[4] : anchors)
{
for (float &q : p)
{
cout << q << ' ';
}
cout << endl;
}
return 0;
}
三维
#include <iostream>
using namespace std;
int main()
{
int anchors[2][2][2] = {{{1, 2}, {2, 3}}, {{5, 6}, {6, 7}}};
//输出
for (int(&r)[2][2] : anchors)
{
for (int(&p)[2] : r)
{
for (int &q : p)
{
cout << q << ' ';
}
cout << endl;
}
cout << endl;
}
return 0;
}