Here is my full function, I am still getting a few errors when I try to compile
Code:
void binsearch(char *dictionary[], int wordnum, char string[]);
Code:
void binsearch(char *dictionary[], int wordnum, char string[]) {
//Establish low and high points
int low = 0;
int high = wordnum - 1;
//Adjust midpoint as necessary
while (low <= high) {
int mid = (low + high)/2;
if (strcmp(string,dictionary[mid])<0)
high = mid - 1;
else if (strcmp(string,dictionary[mid]) > 0)
low = mid + 1;
//Print out correct permutation matches
else if (strcmp(string,dictionary[mid]) == 0){
printf("A permutation of the current word that is valid is %s.\n", string);
fprintf(ofp, "A permutation of the current word that is valid is %s.\n", string);
}
else {
printf("This word has no permutations\n");
}
break;
}
}
any suggestions, I cannot figure it out