Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
3 レベルのギザギザ配列を作成しようとしています。
これが私のコードです:
int[][, ,][,] x = new int[1][, ,][,]{ new int[1,1,1][,] { new int[7,8] } };
次のエラーが表示されます。A nested array initializer is expected
A nested array initializer is expected
私は何を間違っていますか?
a の初期化子がどの[,,]ように見えるかを考えてみましょう。例えば:
[,,]
int[,,] arr = {{{1}}};
したがって、必要なものは次のようになります。
int[][, ,][,] x = new int[1][, ,][,]{ new int[1,1,1][,] {{{new int[7,8]}}} };
または単に:
int[][, ,][,] x = { new int[1,1,1][,] {{{new int[7,8]}}} };