我有這個C++程序:C++雙陣列初始化錯誤
int box[9][9];
box = { {solution[0][0],solution[0][1],solution[0][2],solution[1][0],solution[1][1],solution[1][2],solution[2][0],solution[2][1],solution[2][2]},
{solution[0][3],solution[0][4],solution[0][5],solution[1][3],solution[1][4],solution[1][5],solution[2][3],solution[2][4],solution[2][5]},
{solution[0][6],solution[0][7],solution[0][8],solution[1][6],solution[1][7],solution[1][8],solution[2][6],solution[2][7],solution[2][8]},
{solution[3][0],solution[3][1],solution[3][2],solution[4][0],solution[4][1],solution[4][2],solution[5][0],solution[5][1],solution[5][2]},
{solution[3][3],solution[3][4],solution[3][5],solution[4][3],solution[4][4],solution[4][5],solution[5][3],solution[5][4],solution[5][5]},
{solution[3][6],solution[3][7],solution[3][8],solution[4][6],solution[4][7],solution[4][8],solution[5][6],solution[5][7],solution[5][8]},
{solution[6][0],solution[6][1],solution[6][2],solution[7][0],solution[7][1],solution[7][2],solution[8][0],solution[8][1],solution[8][2]},
{solution[6][3],solution[6][4],solution[6][5],solution[7][3],solution[7][4],solution[7][5],solution[8][3],solution[8][4],solution[8][5]},
{solution[6][6],solution[6][7],solution[6][8],solution[7][6],solution[7][7],solution[7][8],solution[8][6],solution[8][7],solution[8][8]}};
我得到的錯誤是:
error: assigning to an array from an initializer list
這是什麼意思?
對於C++ 11來說這是真的嗎? – innochenti 2012-03-17 12:51:03
在C++ 11中,我的代碼和OP的代碼都是有效的。 – mfontanini 2012-03-17 12:54:56