grid1D[row*col]; grid2D[row][col]; for(int i = 0; i < row; ++i) for(int j = 0; j < col; ++j) grid1D[i * col + j] = grid2D[i][j];