Create a function to delete all elements with value, which is input by user, from array in c program

Create a function to delete all elements with value, which is input by user, from array in c program

You can’t delete an item of an Array in C. You need to move all items to one index left starting from the next element. Then, subtract 1 from the array size.

for (int i = deleteIndex + 1; i < arrSize; i++)
 {
     arr[i - 1] = arr[i];
 }

arrSize = arrSize - 1;