CS140 Midterm Exam - October 5, 2004

For all questions, please use the following file as inputfile:

Tiger Woods 4 72 64 70 71
Vijay Singh 3 69 68 68
Phil Mickelson 5 70 69 77 72 73
Davis Love III 2 72 75
# Comment
Sergio Garcia 3 77 65 69
Cher 4 72 65 70 69
E. Power Biggs 1 99


Question 1

Behold p1.c:

#include < stdio.h >
#include "fields.h"

main()
{
  IS is;
  int i;

  is = new_inputstruct(NULL);

  while (get_line(is) >= 0) {
    if (is->NF >= 3) {
      if (sscanf(is->fields[2], "%d", &i) == 1) {
        printf("%d\n", i);
      }
    }
  }
}

What is the output of: p1 < inputfile