return pointer of an array

I keep getting this error "[Error] invalid conversion from 'int*' to 'int' [-fpermissive]", I have tried everything and still cant fix the error. Any hints?

#include <iostream>
using namespace std;

int *arr_expander(int array, int size);

int main() {

int nums[]={2,3,4,6,7};
int size = 5;

int *expander= arr_expander(nums, size);

for(int i=0; i<size*2;i++){

cout<<expander[i];
}

system("PAUSE");
return 0;
}

int *arr_expander(int array[], int size){

int *p = new int[size*2];

for(int i =0; i<size*2;i++){

if (i<size)
p[i]=array[i];
else
p[i]=0;

}

return p;

}
You have declared arr_expander to take an int as first argument.
Sorry i still don't understand, dont I need to declare it as an int since the elements in the array are ints? Can you please elaborate a little further?
int *arr_expander(int array, int size);

int *arr_expander(int array[], int size){

See the difference? The first one is missing the [].
wow thanks, silly mistake .
Topic archived. No new replies allowed.