I want to remove elements from struct array. I have tried many different versions of my remove()function, but no of them work. This last deletes the element that user spcified and copies onther element to its place.
in main() i have n=remove(a,n)
int remove(Vegies a[], int n){
int i,input,j;
while(1){
printf("Item number to delete: ");
scanf("%d", &input);
for(i = 0; i < n; i++){
if(input == a[i].itemN){
for (j = 0; j < n; j++){
a[j] = a[j + 1];
(n--);
i--;
}
}
if(input==0){
return 0;
}
}
}return 0;
}