Reversing an array using recursion