#include <iostream>
int sum(int(&arry)[2][3])
{
int total = 0;
for (int i = 0; i < 2; i++)
for (int j = 0; j < 3; j++)
total += arry[i][j];
return total;
}
int main()
{
int gg [2][3] =
{
{1, 2, 3},
{4, 5, 6}
};
std::cout << sum(gg) << std::endl;
}
运行结果
21