//http://www.cnblogs.com/lovecreatesbeauty/archive/2004/09/25/46508.aspx
//Rotate a 3*3 array of int by 90 degrees clockwise.
void rotation_90(int (*array)[3])
{
const int ROW=3;
const int COL=3;
int array_tmp[ROW][COL];
This depends on the data structure u use to store matrix .If i implement the matrix myself i would set a pointer to the head(the virtual [0,0] entry) and a rule to determine which way should the matrix be looked at.
e.g:
1 2 3 <----Pointer to head is [0,2] ,rule is VERTICAL.Thus we have represented the
4 5 6 the following matrix: 3 6 9 (A counter-clockwise transformation as u
7 8 9 2 5 8 mentioned)
1 4 7
We then only need an algorithm to translate input index(Vitual index say [1,2]) to its physcial index (e,g:[2,1]).This algorithm should be easy to figure out.(Simply use the rotation matrix on the input index [x,y])