title: segmentation fault in feof(FILE *) inbuilt Function
body: <pre><code>void suffix_strip(FILE *fp)
  {
      FILE *fp1;
      char word[20],ch;
      int len;
      int i=0,j;
      fp1=fopen("sstrip.txt","a+");
      while(!feof(fp))
      {
          ch=fgetc(fp);
          if(ch!='\n' &amp;&amp; ch!='\0' &amp;&amp; ch!=' ' &amp;&amp; ch!='.')
          {
              word[i]=ch;
              i++;
          }
          else
          {
              word[i]='\0';
              i=0;
              len=strlen(word);
              if(len&gt;3)
              {
                  if(word[len-3]=='i' &amp;&amp; word[len-2]=='n' &amp;&amp; word[len-1]=='g')
                  {
                      word[len-3]='\0';
                  }
                  else if(word[len-2]=='e' &amp;&amp; word[len-1]=='d')
                  {
                      word[len-2]='\0';
                  }
  
                  fputs(word,fp1);
  
                  if(count==0)
                  {
                      in[count]-&gt;freq=1;
                      strcpy(in[count]-&gt;word,word);
                      count++;
                  }
                  else
                  {
                      for(j=0;j&lt;count;j++)
                      {
                          if(strcmp(in[j]-&gt;word,word)==0)
                          {
                              in[j]-&gt;freq++;
                              goto x1;
                          }
                      }
                      in[count]-&gt;freq=1;
                      strcpy(in[count]-&gt;word,word);
                      count++;
                      x1:
                          printf("");
  
                  }
                  fputc(' ',fp1);
              }
              else
              {
                  fputs(word,fp1);
                  if(count==0)
                      {
                      in[count]-&gt;freq=1;
                      strcpy(in[count]-&gt;word,word);
                      count++;
                  }
                  else
                  {
                  for(j=0;j&lt;count;j++)
                  {
                      if(strcmp(in[j]-&gt;word,word)==0)
                      {
                          in[j]-&gt;freq++;
                          goto x2;
                      }
                  }
                  in[count]-&gt;freq=1;
                  strcpy(in[count]-&gt;word,word);
                  count++;
                  x2:
                      printf("");
  
              }
              fputc(' ',fp1);
          }
  
      }
  
      }
      display();
  </code></pre>
  
  <p>}</p>
  
  <p>/*</p>
  
  <p>In the above Function when i enter the While loop checking the condition </p>
  
  <p>while(!feof(fp))</p>
  
  <p>the DevC++ IDE running MinGW GCC throws a segmentation fault,but the same code when run on VC++ 6.0 the code runs successfully without any error.
  what might be the problem???
  is it because i am passing the file pointer as an argument???
  of the GCC compiler has some other conventions for the EOF representation??? 
  if it's because of the argument passing then what might be correct way to get it solved using the same manner of parameter passing (i.e passing the file pointer)?? 
  */</p>