जॉइन Examsbook
823 0

प्र: 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); }

  • उत्तर देखेंउत्तर छिपाएं
  • Workspace

उत्तर :
व्याख्या :

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

क्या आपको यकीन है

  त्रुटि की रिपोर्ट करें

कृपया संदेश दर्ज करें
त्रुटि रिपोर्ट सफलतापूर्वक जमा हुई