我有一个指向二维数组的指针,我已声明如下:
int **gameBoard[3][3];
然后将其添加到类构造函数中:
**gameBoard = {
{0,0,0},
{0,0,0}, //<--that's the specific line I am getting the error in
{0,0,0}
};
我甚至将其声明为20x20
,但每次都会出现相同的错误:
too many initializer values
任何帮助?
答案 0 :(得分:1)
您应该声明并初始化二维数组,如下所示:
int gameBoard[3][3] = {
{0,0,0},
{0,0,0},
{0,0,0}
};