Add more comments for problem 3 solution
This commit is contained in:
parent
73983c2c6f
commit
9549e635ac
4
src/p3.c
4
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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user