Recursive C program for Binary search

Below is an example Recursive C program to perform Binary –


int binsearch(int low, int high, in a[], X){

         int mid;
         if(low > high){
            return(-1);
         }
         mid = (low + high) / 2;
         return(X == a[mid] ? mid : X < a [mid] ? binsearch(low, mid-1, a[], X) : binsearch (mid+1,high,a[],X))


}