ch 10/p110.c
//Function to lookup a word in a pre-defined dictionary

Function to lookup a word in a pre-defined dictionary
Function to lookup a word in a pre - defined dictionary
int lookup ( const struct entry dictionary [], const char word [], const int entries )
	{
		int compare_strings ( const char word1 [], const char word2 [] ) ;
		int high = entries - 1, low = 0, mid, result ;
		while ( low <= high ) 
			{
				mid = ( low + high ) / 2 ;
				result = compare_strings ( dictionary [mid].word, word ) ;
				if ( result == -1 )
					low = mid + 1 ;
				else if ( result == 1 )
					high = mid - 1 ;
				else
					return mid ;
			}
		return -1 ;
	}
int lookup ( const struct entry dictionary [ ] , const char word [ ] , const int entries ) { int compare_strings ( const char word1 [ ] , const char word2 [ ] ) ; int high = entries - 1 , low = 0 , mid , result ; while ( low <= high ) { mid = ( low + high ) / 2 ; result = compare_strings ( dictionary [ mid ] . word , word ) ; if ( result == -1 ) low = mid + 1 ; else if ( result == 1 ) high = mid - 1 ; else return mid ; } return -1 ; }
Function to lookup a word in a pre-defined dictionary
Function to lookup a word in a pre - defined dictionary
//Function declaration
 //Checking if word exists in the dictionary using binary search
