What exactly is your question? Does your first example or second example not compile? Does it not do what you are expecting? What have you already tried and what were your results?
When passing information into a function call there are two ways to do so: pass-by-reference and pass-by-value. When you pass in a standard variable (bool, float, FString, etc.) it will use pass-by-value where it creates a copy of the variable and all changes to the value are done on the copy. When you pass in a pointer as a function parameter it uses pass-by-reference where instead of creating a copy of the variable it will pass in a reference to the variables location. So any changes to the variable that is pass-by-reference will affect the original variable outside of the function as well. With arrays, the first element of the array acts as a pointer to the memory location where the array is stored, so anytime an array is passed into a function it is considered to be pass-by-reference which is why changes inside the function affect the array outside of the function as well. Hopefully this clears up why you’re seeing the array value change when you call the function.