title: why cannot i delete Linkedlist Node?
body: <p>I want to create linkedList from Arraylist. I use new curNode and give value, but when I want to delete it after use it, it's wrong. why cannot i  delete curNode?</p>
  
  <pre><code>struct ListNode {
      int val;
      ListNode *next;
      ListNode(int x) : val(x), next(NULL) {}
  };
  
  ListNode *addListNode(int* arr,int n){
      ListNode *head=NULL,*curNode,*tail;
      for(int index=0;index!=n;++index){
          curNode = new ListNode(arr[index]);
          if (head==NULL)
              head=curNode;
          else
              tail-&gt;next=curNode;
          tail = curNode;
          //delete curNode;
      }
      return head;
  }
  </code></pre>