title: Why has the structure pointer have the wrong values
body: <p>So I started looking into Datastructures in C and wanted to code a Singly Linked List.</p>
  <p>this is a small piece of it:</p>
  <pre><code>struct nodes {
      int val;
      struct nodes *next;
  };
  
  void insert(struct nodes *list, int val) {
      struct nodes *tmp = (struct nodes*) malloc(sizeof(struct nodes));
      tmp-&gt;val = val;
      tmp-&gt;next = list;
      list = tmp;
  }
  
  int main() {
      struct nodes *test;
      insert(test, 5);
      insert(test, 10);
  
      printf(&quot;test %d\n&quot;, test-&gt;next-&gt;val);
  }
  </code></pre>
  <p>Here I get totally wrong output. When I try writing a function where I don't have to pass in the structure pointer, it works like expected.</p>
  <p>OUTPUT:</p>
  <pre><code>test 90053
  </code></pre>
  <p>P.S I'm still starting with C so don't judge too hard :D</p>