I'm trying to reverse the sequence of an int
-array. Here's my code which gives a truckload of errors.
#include <cstdlib>
#include <iostream>
using namespace std;
int [] reverseArray(int []);
int main(){
int arr[5] = {3,9,11,2,7};
int arr2[5] = reverseArray(arr);
for (int i = 0; i < 5; ++i)
{
cout << arr2[i] << endl;
}
}
int [] reverseArray(int param[]){
int s = sizeof(param)/sizeof(param[0]);
int j = 0;
int* a[s];
for (int i = s ; i >= 0; i--)
{
a[j] = param[i];
j++;
}
return a;
}
I need to pass the modified array back to the main function. So please don't suggest me void functions that handles the output themselves.