title: Return pointer to the node of the linked list from the function
body: <p>I try to pass the pointer to the linked list node from the function.<br>
  Here the pseudo code (I'm using C):</p>
  
  <pre><code>node_t *node = % first node initialization % ; //global
  
  int func(int valueToFind, node_t *parentNode) {
      while(node = node-&gt;next()) {
          if(node-&gt;value == valueToFind) {
              parentNode = node-&gt;prev();
              return 1;
          }
      }
      return 0;
  }
  
  int main() {
      node_t *parent;
      EDIT:
         parent = malloc(sizeof(node_t));
      END EDIT
      if(1==func(16, parent)) {//searching for value 16
          printf("%d\n", parent-&gt;value);
      }
  }
  </code></pre>
  
  <p>At the line where <code>printf("%d\n", parent-&gt;value);</code> the program is crashing.<br>
  What am I doing wrong?  </p>