int array2d[3][5]{};
for (auto& iter1 : array2d)
{
cout << "iter1 in 2d array - " << iter1 << endl;
for (auto& iter2 : iter1)
{
cout << "iter2 in 2d array - " << iter2 << endl;
}
}
结果
在 2d 数组中的 iter1 - 00CFFCB4
在 2d 数组中的 iter2 - 0
在 2d 数组中的 iter2 - 0
在 2d 数组中的 iter2 - 0
在 2d 数组中的 iter2 - 0
在 2d 数组中的 iter2 - 0
在 2d 数组中的 iter1 - 00CFFCC8
在 2d 数组中的 iter2 - 0
在 2d 数组中的 iter2 - 0
在 2d 数组中的 iter2 - 0
在 2d 数组中的 iter2 - 0
在 2d 数组中的 iter2 - 0
在 2d 数组中的 iter1 - 00CFFCDC
在 2d 数组中的 iter2 - 0
在 2d 数组中的 iter2 - 0
在 2d 数组中的 iter2 - 0
在 2d 数组中的 iter2 - 0
在 2d 数组中的 iter2 - 0
如何将二维数组初始化为 0?
iter1
是一个一维数组的引用)。 - Cruz Jean