int BinarySearch(int key)
{
int left; //left var
int right; //right var
int middle;
left = 0;
right = MAX-1; //MAX is the number of array members
while(left <= right)
{
middle = (left+right)/2;
if(key < Data[middle])
right = middle -1;
else if (key > Data[middle])
left = middle+1;
else if (key == Data[middle])
printf(“Find it! Data[%d] \n”,middle)
return 1; //1 means succes
}
}