Join Examsbook
821 0

Q: Point out the error, if any, in the following program. # include "stdio.h" main() {      FILE *fp;      char str[80];      fp = fopen ("trail", "r");      while (!feof (fp))     {            fgets (str, 80, fp);            puts (str);      }      fclose (fp); }

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

The last line from the file "trial" would be read twice. To avoid this, ues:        While ( fgets (str, 80, fp) ! = NULL)                puts (str);

Are you sure

  Report Error

Please Enter Message
Error Reported Successfully