To reverse the elements of the given array