我如何在不使用指针的情况下在现有数组的索引中创建数组
float[] currentNode = new float[12]
float[] neighbour = new float[12]
neighbour[8] = new float[12]
neighbour[8] = currentNode;
and can access with neighbour[8][1]
其他选择是使用指针的东西。
float *pointer;
int []array = new int[12];
pointer = &array[0];
neighbour[8] = pointer
那么第一个解决方案是否可以不更改我的两个数组?任何其他解决方案? 。
最佳答案
您正在寻找Multidimensional arrays。
int[,] myArray;
myArray = new int[,] {{1,2}, {3,4}, {5,6}, {7,8}}; // OK
关于c# - 如何在现有数组的索引中创建数组,C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8136600/