void rotate( int nrows, int ncols, int x[nrows][ncols] ) { int r, c, elt00; elt00 = x[0][0]; for ( r=0; r<nrows; r++ ) { for ( c=0; c<ncols-1; c++ ) x[r][c] = x[r][c+1]; if ( r < nrows-1 ) x[r][ncols-1] = x[r+1][0]; else x[r][ncols-1] = elt00; } }