diff --git a/src/p3.c b/src/p3.c index 3a62ad0..9365315 100644 --- a/src/p3.c +++ b/src/p3.c @@ -35,6 +35,10 @@ double sum_file(const char* filename) { // A more reliable way of repeatedly reading from a file is checking // the return value of fscanf. On success, fscanf will return the number // of values read. + // + // Do note, using the return value of fscanf means that if an unexpected + // value is encountered, we will stop reading and any remaining values + // will be skipped. while (fscanf(infile, "%lf", &value) == 1) { printf("(fscanf) Adding value %.2lf to sum\n", value);