Find the Bug

Goal: Students run into many of the same errors. I'll give you some common problems I see and I want you to figure out what's wrong (if it will be a compiler problem, seg fault, or unexpected program behavior) and how to fix it. (I'm simplifying some of these so it's easier to find the bug than it was for the student!)

  1.  int counter;
     char words[LENGTH];
     for(counter = 0; counter < ITERATIONS; counter++)                         
          fscanf(data_array, "%s", &words[counter]);                               
     printf("%s", words );