0

I wrote this code below and it isn't working giving me a stack overflow problem.Can someone please help me?

```
#include<iostream>
using namespace std;
int partition(int* A,int l,int r)
{
int v=A[r];
int i=l;
int j=r;
int temp;
while(i<j)
{
while(A[i]<v)
{
i++;
}
while((i<j)&&(A[j]>=v))
{
j--;
}
if (i<j)
{
temp=A[i];
A[i]=A[j];
A[j]=temp;
}
else
{
temp=A[i];
A[i]=A[r];
A[r]=temp;
}
}
return i;
}
void quicksort(int* A,int l, int r)
{
if(r>1)
{
index=partition(A,l,r);
quicksort(A,l,index-1);
quicksort(A,index+1,r);
}
}
int main()
{
int myArray[10]={3,4,2,1,8,7,5,9,6,0};
for(int i =0; i<10; i++)
{
cout << myArray[i] << " ";
}
cout << endl;
quicksort(myArray,0,9);
for(int i=0; i<10;i++)
{
cout << myArray[i] << " ";
}
system("pause");
return 0;
}
```