I tried implementing your approach but it didnt quite work :-/. I really don't know why.
Code:int rotate(PIXEL* original, int rows, int cols, int rotation, PIXEL** new, int* newrows, int* newcols) { int c,r; //for 90 or -270 degrees if(rotation == 90 || rotation == -270 ) { for(r = 0; r < rows; r++) { for(c = 0; c < cols; c++ ) { *newcols = -r; *newrows = c; }//end of for }//end of for }//end of if return 0; }