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.
我正在尝试创建一个三级锯齿状数组。
这是我的代码:
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]}}} };