I have this function:
HOTEL* delh(HOTEL *h , int *n, int k)
{
int i;
HOTEL *p;
for(i=k; i<*n-1; i++)
{
h[i]= h[i+1];
}
p = (HOTEL *)realloc(h, (*n-1)*sizeof(*p) );
if (p==NULL)
{
return p;
}
*n = *n - 1;
return p;
}
Where Hotel is a struct.When I cal this function in main i got error: invalid conversion from 'int' to 'int*'| and error: initializing argument 2 of 'HOTEL* delh(HOTEL*, int*, int)'|. I did it in this way:
case 13:
printf("Enter position: ");
scanf("%d", &k);
p = delh(h, n, k); //here is the error
if (p == NULL)
{
puts("memory was not reallocated");
}
else
{
h = p;
}
getch( );
break;
Before this i create an array of struct variables.