Help rahul search code showing run error

why is this code showing run error in one test case https://ide.codingblocks.com/s/77014

I guess there is no need for writing the binary search function 2 times.
in the question it is mentioned that the array is rotated but still a simple recursive function will work.
int search(int arr[],int n,int i,int key)
{
if(i==n)
{
return -1;
}
if(arr[i]==key)
{
return i;
}
return search(arr,n,i+1,key);
}

Thanks your code worked