Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int** arr = new int* [2];
- arr[0] = new int[10]{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- arr[1] = new int[10]{ 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
- for (size_t i = 0; i < 2; i++){
- for (size_t j = 0; j < 10; j++)
- cout << arr[i][j] << ' ';
- cout << endl;
- }
- cout << endl;
- swap(arr[0], arr[1]);
- for (size_t i = 0; i < 2; i++){
- for (size_t j = 0; j < 10; j++)
- cout << arr[i][j] << ' ';
- cout << endl;
- }
- cout << endl;
- delete[] arr[0], arr[1], arr;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment