Another problem is that your array is being passed by value. This means that a copy is being changed and nothing is being changed in the actual array.
That's a misunderstanding.
When an array is passed as a function parameter, what is actually passed is a pointer to the start of the array. Yes, the pointer itself is passed by value, but that doesn't prevent it from being dereferenced to access the actual contents of the original array.