title: Why do I get a segmentation error?
body: <p>I have this code, which is part of a library for handing a database (as a linked list):</p>
  
  <pre><code>char *db_getVal(char *key, Node *database) { 
      while(database != NULL){
          if(strcmp(key, database-&gt;key) == 0){ 
              return database-&gt;value;
          }else{
              database = database-&gt;next;
          }
      }
      return NULL;
  }
  </code></pre>
  
  <p>It works fine when I use a key that exists in database, but when I enter a key that does not, I get a segmentation fault. Why is that?</p>