So i am new to programming and i have this program that i have to write, it has an array of integers and i have to pass it to a function with a pointer and then with a double pointer. After i wrote the code i had this error that i couldn't find a solution to. The error is :
initialization of 'int **' from incompatible pointer type 'int *' [-Wincompatible-pointer-type]
The code that i wrote is this:
int main(){
int i;
int arr[]={3,-15,19,0,-984};
int *p=arr;
funzione(p,sizeof(arr)/sizeof(arr[0])); //The first function
for(i=0;i<(sizeof(arr)/sizeof(arr[0]));i++) //print of the single pointer (p)
printf("%d\n",p[i]);
int **g=p; //the error results to be coming from p in this row
for(i=0;i<(sizeof(arr)/sizeof(arr[0]));i++) //print of the double pointer (g)
printf("%d\n",g[i]);
funzione2(g,sizeof(arr)/sizeof(arr[0])); //The second function
return 0;
}
My question is how can i remove this error.