Pointer issues

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <conio.h>


using namespace 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).
Hi Keene thanks for your quick reply. I am trying to use a pointer that is pointing to an array.
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.
ah I see. Alright I guess i'm going to have to take a breather and figure out what I need to do. Thanks for your help!
Topic archived. No new replies allowed.