How do I modify an array that is a parameter to a function?

Take a look at TArray::RemoveAll.

One example of how to use it How do i remove items from a TArray while iterating? - #2 by Br_P_d