for (x = 0; x < N; x ++) { for (y = 0; y < N; y ++) { newSquare[x][y] = oldSquare[y][N-1-x]; } }
Of course, in certain representations of the square (such as using a 1-d array) even simpler algorithms can be used.
for (x = 0; x < N; x ++) { for (y = 0; y < N; y ++) { newSquare[x][y] = oldSquare[y][N-1-x]; } }
Of course, in certain representations of the square (such as using a 1-d array) even simpler algorithms can be used.