title: Pointer initialization
body: <p>Sorry if this question has been asked before. On my search through SO I didn't find one that asked what I wanted to know. </p>
  
  <p>Basically, when I have this:</p>
  
  <pre><code>typedef struct node
  {
      int data;
      node *node;
  } *head;
  </code></pre>
  
  <p>and do <code>node *newItem = new node;</code></p>
  
  <p>I am under the impression that I am declaring and reserving space, but not defining, a pointer to <code>struct node</code>, is that correct?</p>
  
  <p>So when I do</p>
  
  <p><code>newItem-&gt;data = 100</code> and <code>newItem-&gt;next = 0</code></p>
  
  <p>I get confused. <code>newItem = 0</code>would declare what exactly? Both <code>data</code> and <code>next</code>? The object as a whole? </p>
  
  <p>I'm especially confused when I use typedef. Which part is the macro? I assume node because that's how I call it, but why do I need it? </p>
  
  <p>Finally, what happens when I do:</p>
  
  <pre><code>node *temp;
  temp = new node;
  
  temp = head-&gt;next;
  head-&gt;next = newItem;
  newItem-&gt;next = temp;
  </code></pre>
  
  <p>I mean, head->next is  a pointer pointing to object newItem, so I assume not to newItem.data or next themselves. So how can I use an uninitialized pointer that I described above safely like here? is head now not pointing to an uninitialized pointer? </p>