我有这个函数旨在将多维 2d (6x6) 数组初始化为零。我使用 cout 调用 main 中的函数来测试它并输出垃圾。请帮忙。谢谢!
int** initializeArray(void)
{
typedef int* rollArray; //this line is actually outside of the function in my
//program
int i, j;
rollArray *m = new rollArray[6];
for (i = 0; i < 6; i++)
m[i] = new int[6];
for (i = 0; i < 6; i++)
for (j = 0; j < 6; j++)
m[i][j] = 0;
return m;
}