title: Linked list program crash
body: <p>Well, I am trying to write a linked list (a very simple linked list) with very few code. This is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  class node
  {
  public :
  
      int data = 0;
  
      node* next;
  };
  
  node node_obj;
  
  int main()
  {
      node* head;
      node* node_pointer = head;
      node_pointer = node_obj.next;
      node_pointer-&gt;data = 4;
      node_pointer = node_obj.next;
      node_pointer-&gt;data = 5;
      node_pointer = node_obj.next;
      node_pointer-&gt;data = 6;
      node_pointer = node_obj.next;
  
      return 0;
  }
  </code></pre>
  
  <p>I am trying just to make it work at first, that's why there are no add, print or remove functions.</p>
  
  <p>Anyway every time I run the program it crashes and I get an error code  C0000005.</p>
  
  <p>As far as I know this is an error that indicates memory access violation but I can't find the solution. 
  Update:
  I changed my code and now it looks like this(included only the changed part):<br /></p>
  
  <pre><code>class node
  {
  public :
      node();
      int data = 0;
      node* next;
  };
  node::node()
  {
      next = new node;
  }
  </code></pre>
  
  <p>So now i have an initialized '     new' pointer and the error code changed to c00000fd </p>