title: passing argument 2 of ‘search_and_count’ from incompatible pointer type [enabled by default]
body: <p>I'm getting a bunch of pointer errors and pointers are not exactly my strongest point. Most of my errors have to do with passing an argument.</p>
  
  <p>The errors are:</p>
  
  <blockquote>
    <p>HW5_mkhan44.c: In function ‘main’: HW5_mkhan44.c:31:3: warning:
    passing argument 1 of ‘search_and_count’ from incompatible pointer
    type [enabled by default]</p>
    
    <p>HW5_mkhan44.c:11:6: note: expected ‘struct FILE *’ but argument is of
    type ‘struct FILE **’</p>
    
    <p>HW5_mkhan44.c:31:3: warning: passing argument 2 of ‘search_and_count’
    from incompatible pointer type [enabled by default]</p>
    
    <p>HW5_mkhan44.c:11:6: note: expected ‘const char *’ but argument is of
    type ‘char * (*)[100]’</p>
    
    <p>HW5_mkhan44.c:31:3: warning: passing argument 3 of ‘search_and_count’
    from incompatible pointer type [enabled by default]</p>
    
    <p>HW5_mkhan44.c:11:6: note: expected ‘int *’ but argument is of type
    ‘int **’</p>
    
    <p>HW5_mkhan44.c:31:3: warning: passing argument 4 of ‘search_and_count’
    from incompatible pointer type [enabled by default]</p>
    
    <p>HW5_mkhan44.c:11:6: note: expected ‘int *’ but argument is of type
    ‘int **’</p>
  </blockquote>
  
  <p>This is the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  
  int word_search(const char *word, const char *str);
  int character_count(const char *curr_str);
  void search_and_count(FILE *fpter, const char *c, int *len, int *result);
  
  int main(void)
  {
          FILE *fileptr;
          char filename[100];
          char* word[100];
          int *length;
          int *num;
  
          printf("Please input the text file name: ");
          scanf("%s", filename);
  
          fileptr = fopen(filename, "r");
  
          if(fileptr == NULL)
                  printf("File does not exist\n");
          else{
                  printf("Please enter a word to search: ");
                  scanf("%s", word);
                  search_and_count(&amp;fileptr, &amp;word, &amp;length, &amp;num);
  
                  if(*num == 0){
                          printf("Word exists in file");
                          printf("There are %d characters in file", *length);
                  }
                  else
                          printf("Word does not exist in file");
          }
          fclose(fileptr);
  
          return 0;
  }
  
  int word_search(const char *word,const char *str)
  {
          int num;
     if(strcmp(word, str) == 0){
                  num = 0;
                  return(num);
          }
          else{
                  num = 1;
                  return(num);
          }
  }
  
  int character_count(const char *current_str)
  {
          int word_length;
  
          word_length = strlen(current_str);
  
          return(word_length);
  }
  
  void search_and_count(FILE *fpter, const char *c, int *len, int *result)
  {
          char line[120];
  
          while(fgets(line, sizeof(line), fpter)){
                  char* t = strtok(line, " ");
                  *len = word_search(c, t);
                  *result = character_count(t);
          }
  }
  </code></pre>