title: Pointer (trick): Memory Reference
body: <p>A trick question about C pointer. Read code snippet below  and try explain why the list value changed (this question was based on <a href="http://jeffreystedfast.blogspot.com/2010/01/weird-bugs-due-to-gcc-44-and-strict.html" rel="nofollow noreferrer">this</a> code):</p>
  
  <p><em>tail</em> has the memory address of <em>list</em>.</p>
  
  <p>How is possible <em>list</em> be changed below?</p>
  
  <pre><code>typedef struct _node {
     struct _node *next;
     int value;
  }Node;
  
  
   int main(){
     Node *list, *node, *tail;
     int i = 100;
  
     list = NULL;
     printf("\nFirst . LIST value = %d", list);
  
    tail =(Node *) &amp;list;
    node = malloc (sizeof (Node));
    node-&gt;next = NULL;
    node-&gt;value = i;
  
    //tail in this point contains the memory address of list
    tail-&gt;next = node;
    printf("\nFinally. LIST value = %d", list);
    printf("\nLIST-&gt;value = %d", (list-&gt;value));
  
  return 0;
  </code></pre>
  
  <p>}</p>
  
  <p>---- Output</p>
  
  <blockquote>
    <blockquote>
      <p>First . List value = 0</p>
    </blockquote>
  </blockquote>
  
  <p>why this values ??? im not expecting this ... </p>
  
  <blockquote>
    <blockquote>
      <p>Finally . LIST value = 16909060</p>
      
      <p>LIST->value = 100</p>
    </blockquote>
  </blockquote>