Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int* flipArray(int input[], int n)
- {
- int output[n];
- int pos = 0;
- for (int i = n-1; i >= 0; i--)
- {
- output[pos++] = input[i];
- }
- int* p = output;
- for (int k = 0; k < n; k++)
- cout << *p-k << endl << endl;
- return p;
- }
- int main()
- {
- const int SIZE = 5;
- int firstArray[SIZE];
- for (int n = 0; n < SIZE; n++)
- {
- firstArray[n] = n+1;
- }
- int* a;
- a = flipArray(firstArray, SIZE);
- for (int j = 0; j < SIZE; j++)
- cout << *a-j << endl;
- cout << endl;
- cout << *a << '\t' << *a+1 << '\t' << *a+2;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement