3D to 1D array 3D陣列 轉 1D陣列 Array[i][j][k] array[i][j][k] Array [i×DIM(j)+ j + k ×DIM(i) × DIM(j)] array [i×DIM(j)+ j + k ×DIM(i) × DIM(j)] Output array[0][0][0] = 0 array[0][0][1] = 1 array[0][1][0] = 1 array[0][1][1] = 2 array[1][0][0] = 1 array[1][0][1] = 2 array[1][1][0] = 2 array[1][1][1] = 3 參考資料 [1]. printf - C++ Reference (cplusplus.com)