Answer 2D13

#include <stdio.h>
#include <stdlib.h>

#define NUMCOLS 10
#define NUMROWS 10
 
void transpose( int nrows, int ncols, int x[nrows][ncols]  )
{
  int r, c;

  for ( r=0; r<nrows; r++ )
    for ( c=0; c<r; c++ )
    {
       s = x[r][c];
       x[r][c] = x[c][r];
       x[c][r] = s;
    }
}



Back to Puzzle Home