Array data min, max, avg

I would need to store the measured data in an array sort from smallest to largest and then delete the 3 largest and 3 smallest and then make an average.
Don't know how to do it?

You don't need to delete anything - simply ignore it/them.

Using FOR (), I will measure the ultrasound distance and I would like to filter out the wrong measurements to get the most accurate measurement.
It can measure 543mm, then 545mm and out of nowhere 555 and back to 543, etc. Now I'm averaging the data, but that's not enough. I would like to store the data in an array and delete a few minimum and maximum ranks before making an average.

So, store the results in an array of appropriate type, and use the qsort function to sort them.
Then sum from the fourth element (index 3) to the nth-3 element.

I have sorted the data, but unfortunately I do not understand exactly how I can delete the data. 3 last and 3 first in array.

Thank you very much for your help

You don't need to delete anything, simply ignore them (skip over them)

If you have a for loop that iterates over the whole array, if might look like this

for (int i = 0; i < arraySize; i++)

Now, the for loop doesn't have to begin at zero...