Querry over testcase false

You are approaching wrong recursion, use if(ar[0]<=ar[1] && sortArray(ar+1,n-1)
{
return 1;
}