Given an array arr of integers, reverse the array in place without using built-in language functions such as reverse() or slicing. Return the reversed array after modifying it by swapping elements from both ends toward the center.
def reverse_array(arr):