title: Errors with set_add and set_contains
body: <p>I have currently made a set ADT which uses linked list functions to implement the given interface.</p>
  
  <p>The testing utility we have for testing the set ADT gives me errors on set_add and set_contains. </p>
  
  <pre><code>// Push function, pushes element on head of set
  void Push(set_t **set, void *elem) {
          // Allocates memory for a newNode
          set_t *newNode = (set_t *) malloc(sizeof(set_t));
          // sets element to elem which is in input
          newNode-&gt;elem = elem;
          // Previous head to next
          newNode-&gt;next = *set;
          // Newnode as head
          *set = newNode;
  }
  
  void AppendNode(set_t **headRef, void *elem) {
          set_t *current = *headRef;
          set_t *newNode;
  
          newNode = malloc(sizeof(set_t));
          newNode-&gt;elem = elem;
          newNode-&gt;next = NULL;
  
          if (current == NULL) {
                  *headRef = newNode;
          }
          else {
                  while ( current-&gt;next != NULL) {
                          current = current-&gt;next;
                  }
                  current-&gt;next = newNode;
          }
  }
  
  /*
   * Adds the given element to the given set.
   */
  void set_add(set_t *set, void *elem) {
          if (set_contains(set, elem) == 1) {
                  return;
          }
          else {
                  AppendNode(&amp;set, elem);
          }
  }
  
  /*
   * Returns 1 if the given element is contained in
   * the given set, 0 otherwise.
   */
  int set_contains(set_t *set, void *elem) {
          set_t *current = set;
  
          while (current != NULL) {
                  if (current-&gt;elem == elem) {
                          return 1;
                  }
                  current = current-&gt;next;
          }
  
          return 0;
  }
  </code></pre>
  
  <p>It doesn't matter if I use Push to push on head or use AppendNode to add on the tail end.</p>
  
  <p>Here's my set struct:</p>
  
  <pre><code>struct set { 
     void *elem; 
     set_t *next; 
     cmpfunc_t cmpfunc; 
  }
  </code></pre>
  
  <p>Does someone see something that is very off?</p>