title: Printing Pointer Value a Second Time Returns Wrong Result
body: <p>Can someone explain me what I'm doing wrong?
  I'm studying linked lists. So, I wrote a function to insert in front.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  typedef struct IntElement{
      struct IntElement *next;
      int data;
  
  } IntElement;
  
  bool insertInFront (IntElement **head, int data);
  
  
  int main (void){
  
      IntElement *head;
      insertInFront ( &amp;head, 10);
      cout &lt;&lt; head-&gt;data&lt;&lt;endl;
      insertInFront ( &amp;head, 20);
      cout &lt;&lt; head-&gt;data&lt;&lt;endl;
      insertInFront ( &amp;head, 30);
      cout &lt;&lt; head-&gt;data&lt;&lt;endl;
      cout &lt;&lt; head-&gt;data&lt;&lt;endl;
      insertInFront ( &amp;head, 40);
      cout &lt;&lt; head-&gt;data&lt;&lt;endl;
      cout &lt;&lt; head-&gt;data&lt;&lt;endl;
      return 0;
  }
  
  bool insertInFront (IntElement **head, int data){
  
      IntElement newElem;
      newElem.data = data;
      newElem.next = *head;
      *head = &amp;newElem;
      return true;    
  
  }
  </code></pre>
  
  <p>The whole program seems ok, but when I print the result for a second time, it returns a wrong value.</p>
  
  <p>For instance:</p>
  
  <pre><code>10
  20
  30
  1447361072
  40
  1447361072
  </code></pre>