title: How to Transpose a Non-Square Matrix?
body: <p>I have this code for transposing a matrix:</p>
  
  <pre><code>for(j=0; j&lt;col; j++) { 
      for(k=0; k&lt;row; k++) {
          mat2[j][k] = mat[k][j];
      }
  </code></pre>
  
  <p>It seems to work on a square matrix but not on a nonsquare matrix. Help me!</p>