Name: ____________________________________________________ Alpha: _____________ Section:________

Describe help received: _________________________________________________________________

See the bottom for how to submit your work.

Due: Before 0800 on next class day

  1. (10 pts) Read today's lecture notes. Honestly declare how you read the notes.
    1. (10 pts) I read the notes carefully. I have a good understanding of the topics therein.
    2. (10 pts) I read the notes carefully, but I don't really understand the following points well:
      
      
      
    3. (0 pts) I didn't read the notes carefully.
  2. [90pts] Write a program hw.c that works as follows:
    1. It reads in lower-case words, ending with the word "END"
    2. Then, it stores them in a linked list.
    3. Then, it reads in a single letter.
    4. Then, it prints out all words that start with that letter, in reverse order from how they were read in.

    Tip:

    • Use a static array of characters when dealing with a string. E.g.
      char s[128];
      
    • You probably need to use strcpy, strcmp, and strlen functions. Do include string.h
    • scanf doesn't skip space when reading a char unless it is told to do so.
      
      // DON'T DO THIS TO READ A CHAR
      scanf("%c", &c);
      // BUT DO THIS
      scanf(" %c", &c); //" " before %c tells scanf to skip whitespace
      
    Example runs:
    ~/$ ./hw
    Enter words followed by END:
    one two three four five six seven eight END
    What letter? t
    three
    two
    
    ~/$ ./hw
    Enter words followed by END:
    aa ab ac ad END
    What letter? a
    ad
    ac
    ab
    aa
    
    ~/$ ./hw
    Enter words followed by END:
    aa ab ac ad END
    What letter? b
    

    Submit to the submission server (due: 0800 on the next class day)

    ~/bin/submit -c=IC210 -p=hw39 hw.c
    
    Bring to class