How to pass arrays as arguments to functions