I am not sure why it keeps telling me invalid converstion from 'int' to int*' three of them for line 14 and one for line 16. I've tried messing with it and just can't seem to figure it out. Is there something I am missing about pointers? Thanks for your help.
#include <iostream>
#include <conio.h>
usingnamespace std;
int extend(int , int);
int main()
{
int *farray[] = {1, 2, 3};
extend (farray, 3);
return 0;
}
int *extend(int *farray, int three )
{
cout << "In the function";
}
Are you trying to use an array or a pointer? Because on line 14, you're trying to use both which is incompatible. You have to choose either to use a pointer (denoted by *) or an array (denoted by []). You must choose one or the other (including your function on lines 7/22).
To my knowledge, you cannot do that. You either need to choose an array or pointer. If need be, you can create the equivalent of an array using a pointer (that's if you need to point to something else at sometime in the life of the program) using malloc or the new operator.
The error your compiler is throwing at you is that *array[] is an invalid declaration, so what you're trying to do is not syntantically correct.