int n = 5; float[][] x = new float[n][]; float[][] y = new float[n][]; float[][] z = new float[n][]; //交错数组元素对应相加 for (int i = 0; i < n; i++) { for (int j = 0; j < x[i].Length; j++) { z[i][j] = z[i][j] + y[i][j]; } }
先声明一样长度的,然后for循环赋值