Guest User

Untitled

a guest
Jan 29th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. int** copy_of(int** matrix, int n) {
  2. int** new_matrix = new int*[n];
  3. for (int row = 0; row < n; row++) {
  4. new_matrix[row] = new int[n];
  5. for (int col = 0; col < n; col++) {
  6. new_matrix[row][col] = matrix[row][col];
  7. }
  8.  
  9.  
  10. for (int row = 0; row < n; row++) {
  11.  
  12. for (int col = 0; col < n; col++) {
  13. matrix[row][col] = new_matrix[col][row];
  14. }
  15.  
  16. }
  17. return matrix;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment