An array holds values of one type side by side, numbered from 0: an array of n elements has indexes 0 to n - 1. When you pass an array to a function, C passes only the address of its first element, so the function cannot ask how long it is. That is why C functions take the length as a separate parameter, such as int n.
Reading a[n], one past the end, is undefined behavior: C does not check, and a real build may read whatever sits in the next bytes. The loop for (int i = 0; i < n; i++) visits each index exactly once.
Because the function receives the address, it can also change the caller's array. Mark the parameter const when the function only reads it.