title: Binary Search through Array of Strings - C
body: <p>So I am attempting to use a binary search to find a certain word within a dictionary of words in an array. Currently my function looks like this,</p>
  
  <pre><code>void binsearch(char letters[], char changeletters[], char **dictionary[], int numwords){
  
  printf("start binsearch\n");
  int max = numwords;
  int min = 0;
  int mid;
  int spot;
  
  while (min &lt;= max){
  
  printf("start while in search\n");
  
      mid = (min + max) / 2;
      spot = strcmp(**dictionary[mid],changeletters);
      printf("%d", spot);
  
      if (spot == 0){
          printf("word found\n");
          printf("A permutation of %s that is a valid word is %s", letters, changeletters);
      }
      else if (spot &lt; 0){
          printf("word not found and word is lower\n");
          min=spot+1;
      }
      else{
          printf("word no found and word is higher\n");
          max=spot-1;
      }
   }
  
       if( max &gt; min)
           printf("Sorry, no permutations of %s form a word", letters);
  }
  </code></pre>
  
  <p>The random printfs are to check how far the program is getting. Currently it fails at the string compare and I am not sure why. Any Ideas?</p>