int[X] // Where X is a compile-time positive integer
are exactly the same as
when in a function parameter list (I left out the optional names).
Additionally, an array name decays to a pointer to the first element when passed to a function (and not passed by reference) so both
int firstarray and
int secondarray decay to
It also happens that both an array dereference and a pointer dereference with subscript syntax (subscript syntax is
x[y]) yield an lvalue to the same element when you use the same index.
These three rules combine to make the code legal and work how you expect; it just passes pointers to the function, along with the length of the arrays which you cannot know after the arrays decay to pointers.