serial.write(array,sizearray) by value or reference

Hi my question is maybe simple but very important for my knowledge and my code structure. If I sent a array with UART like this example:

byte array[3];

array[0]=4;
array[1]=4;
array[2]=4;

Serial1.write(array,3); //send 3 bytes of the array
array[2]=0;

I know the UART is asynchronous so the UART begin to send in background when the line "array[2]=0;" is executed. In this situation if array is transfered by value to the function write, bytes sended will be 4,4,4. But if array is transfered by reference bytes sended will be 4,4,0.

So Serial1.write parameter array is by value or reference?

Thank you!

The values in the array are copied to the output buffer before the write returns, so value or reference is irrelevant.

AWOL is right.

In your example you write the array to serial before you change it so it will return 444.
if you resend after you amend the value, it should send 440, irrelevant of how it is sent.