#include <iostream>
#include <algorithm>
#include <iterator>
int *reverse(int *arr, int size)
{
    int *copyArray = new int[size];
    std::reverse_copy(arr, arr+size, copyArray);
    return copyArray;
}
int *expand(int *arr, int size)
{
    int *newArray = new int[size * 2]();
    std::copy(arr, arr+size, newArray);
    return newArray;
}
int *shift(int *arr, int size)
{
    int* newArray = new int [size + 1]();
    std::copy(arr, arr+size, newArray+1);
    return newArray;
}

void display2(int arr[], int size)
{
    std::copy(arr, arr+size, std::ostream_iterator<int>(std::cout, " "));
    std::cout << '\n';
}
int main()
{
    int const SIZE = 5;

    int myArray [SIZE] = {1, 2, 3, 4, 5};
    int *arraPtr = reverse(myArray, SIZE);
    display2(arraPtr, SIZE);
    delete [] arraPtr;

    int myArray2 [SIZE] = {1, 2, 3, 4, 5};
    int *arraPtr2 = expand(myArray2, SIZE);
    display2(arraPtr2, SIZE*2);
    delete [] arraPtr2;

    int myArray3 [SIZE] = {1, 2, 3, 4, 5};
    int *arraPtr3 = shift(myArray3, SIZE);
    display2(arraPtr3, SIZE+1);
    delete [] arraPtr3;
}
