title: How to iterate through a list in c
body: <p>Let "List" be a struct that represents a singly-linked list, i have the following function:</p>
  
  <pre><code>int List_contains(List node, const char* key) {
      List *search;
      search=node.next; 
      assert(search-&gt;key!=NULL);
      return 1;
  }
  </code></pre>
  
  <p>and List is  the following struct:</p>
  
  <pre><code>typedef struct List { /*A new node*/
      char* key;
      void* value;
      struct List *next;
  } List;
  </code></pre>
  
  <p>The function "List_contains" should tell me if "key" is contained in the list or not. Problem is, i can't iterate through the list, and the line </p>
  
  <pre><code>assert(search-&gt;key != NULL);
  </code></pre>
  
  <p>throws a Segfault. How can i iterate through the list with what i have?</p>
  
  <p>(Note: The function is, obviously, not "completed".)</p>