Using C Write a recursive function that reverses an array vo
Using C++:
Write a recursive function that reverses an array: void reverse Array (Array Type a, int first, int last);/* reverse the contents of a[first], ..., a[last] */Solution
void reverseArray(int array[], int first, int last){
int temp;
if(first < last){
temp=array[first]; // assaign array first element to temp
array[first]=array[last];// now last element to first element
array[last]=temp;// first element to last element(i.e temp = first)
// recursively calling reverseArray fucntion
reverseArray(array, first+1,last-1);
}
}
![Using C++: Write a recursive function that reverses an array: void reverse Array (Array Type a, int first, int last);/* reverse the contents of a[first], ..., a Using C++: Write a recursive function that reverses an array: void reverse Array (Array Type a, int first, int last);/* reverse the contents of a[first], ..., a](/WebImages/31/using-c-write-a-recursive-function-that-reverses-an-array-vo-1087903-1761572336-0.webp)