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); }
Correct Answer: The last line from the file "trial" would be read twice To avoid this, ues: While ( fgets (str, 80, fp) ! = NULL) puts (str);