I'm trying to create a delete function that accept an index to delete and return the value stored at the index to the user after it has been deleted from the array, but when I ran the program and try to delete an element the value is remain in the array.
Here is my code:
Code:
void deleteFunc(struct Array *myArr, int x ){
int i, size;
if(myArr -> length == 0)
{
printf("Value not found is in Array \n\n");
return ;
}
if(x >= 0 && x < myArr -> length){
for(i = x; i < myArr -> length -1; i++){
myArr -> A[i] = myArr -> A[i+1];
}
myArr -> length--;
printf("Array before deletion: ");
for(i = 0; i < size; i++){
printf("%d", myArr[i]);
}
printf("Array after deletion: ");
for(i = 0; i < size; i++){
printf("%d", myArr[i]);
}
}
Enable GingerCannot connect to Ginger Check your internet connection
or reload the browserDisable in this text fieldEditEdit in GingerEdit in Ginger×Enable GingerCannot connect to Ginger Check your internet connection
or reload the browserDisable in this text fieldEditEdit in GingerEdit in Ginger×Enable GingerCannot connect to Ginger Check your internet connection
or reload the browserDisable in this text fieldEditEdit in GingerEdit in Ginger×Enable GingerCannot connect to Ginger Check your internet connection
or reload the browserDisable in this text fieldEditEdit in GingerEdit in Ginger×Enable GingerCannot connect to Ginger Check your internet connection
or reload the browserDisable in this text fieldEditEdit in GingerEdit in Ginger×