Implement a recursive function to reverse a sorted array.

Implement a recursive function to reverse a sorted array. Ie, given the array [ 1, 2, 3, 4, 5] your
procedure should return [5, 4, 3, 2, 1].


1
2
3
int reverse(int mydata[], int start, int end){
return reverse(...)

1
2
3
4
5
6
7
void thefunction (int mydata[], int end) 
{
if (end > 0)
{ 
cout << mydata[end]; 
thefunction (mydata [], end -1); 
}



Is this what your looking for?
Last edited on
@kingkong200


Your function does not reverse arrays. And moreover it is simply incorrect and contains a bug.
Last edited on
Topic archived. No new replies allowed.