title: Why the program crased even thoungh I got the correct result?
body: <p>I am learning the data structure of LinkList, and I have already implemented the source code that works for me. Today I try to do it in another way like below. And I am confusing why the programe will be crashed even though I get the result I want.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  
  #define OK 1
  #define ERROR 0
  
  typedef int ElemType;
  typedef int Status;
  
  typedef struct LNode
  {
      ElemType data;
      struct LNode *next;
  }LNode, LinkList;   //I don't use the *LinkList on purpose to check it out
  
  //Initialize LinkList: Create a head node
  Status InitList(LinkList *L)
  {
      L = malloc(sizeof(LinkList));
      if(!L) return ERROR;
      L-&gt;next = NULL;
  
      return OK;
  }
  
  //CreateList
  Status CreateListHead(LinkList *L, int n)
  {
      LinkList *s;
      int i;
  
      if(n &lt; 1) return ERROR;
      InitList(L);
      srand(time(0));
  
      for(i=0; i&lt;n; i++)
      {
          s = malloc(sizeof(LinkList));
          if(!s)  return ERROR;
          s-&gt;data = rand()%10+1;
          s-&gt;next = L-&gt;next;
          L-&gt;next = s;
      }
  
      return OK;
  }
  
  //Travese LinkList
  void Traverse(LinkList *L)
  {
      while(L-&gt;next)
      {
          printf("%d ", L-&gt;next-&gt;data);
          L-&gt;next = L-&gt;next-&gt;next;
      }
  }
  
  int main()
  {
      LinkList *L;
      int s;
  
      s = InitList(L);
      if(s) printf("Successful！");
      else printf("Failed!");
  
      CreateListHead(L, 10);
  
      Traverse(L);
      return 0;
  }
  
  </code></pre>
  
  <p>And the result is: Succesful! 1 6 4 6 1 1 8 2 8 2
  And then the program crashed</p>