[prev] [index] [next]

Tips for Next Week's Lab


Linked lists of strings and chars

  • Build a linked list of strings

    1. Define new type of type of LL nodes

      typedef struct _Node {
         char *data;           // a pointer to string data
         struct _Node *next;
      } NodeT;
      

    2. Adapt known LL functions to this new node type (if necessary)
      • makeNode(), insertHead(), insertTail(), printList(), freeList()
      • which of these functions can be used unchanged?
    3. Write main() function
      • to process user input
      • and call insertHead() or insertTail() as required