Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int** copy_of(int** matrix, int n) {
- int** new_matrix = new int*[n];
- for (int row = 0; row < n; row++) {
- new_matrix[row] = new int[n];
- for (int col = 0; col < n; col++) {
- new_matrix[row][col] = matrix[row][col];
- }
- for (int row = 0; row < n; row++) {
- for (int col = 0; col < n; col++) {
- matrix[row][col] = new_matrix[col][row];
- }
- }
- return matrix;
- }
Advertisement
Add Comment
Please, Sign In to add comment