I'm trying to search for a word in an array of strings, everytime it gets to the while loop it just loops infinitely. It's getting the words and comparing just that when it gets to the second else,
It just takes a fat dump. Can anyone help? So damn frustrating. Note, I tried comparing strings, cstrings, stings.c_str() and cstrings, same thing, it just a loops.
int binarySearch(string *dictionary, char word[])
{
int low = 0;
int high = lexiSize;
int med = (high + low)/2;
bool found = false;
while(!found && low < high)
{
med = (high + low)/2;
if(dictionary[med] == word)
{
found = true;
return med;
}
if(dictionary[med] > word)
{
med = high;
}
else
{
med = low;
}
}
return -1;
}