title: Allocating memory to a struct using pointers
body: <p>I have the following linked list:</p>
  
  <pre><code>struct node {
      int d;
      struct node *next;   
  };
  
  int main()
  {
      struct node *l = 0;
      struct node *k = l;
      k = malloc(sizeof(struct node));
      /* l-&gt;d = 8; */
      return 0;
  }
  </code></pre>
  
  <p>Why is the commented code wrong to use? I don't understand why the memory isn't allocated for the node that ``l points to since <code>k</code> points to the same node as <code>l</code> and I used the <code>k</code>-pointer to allocate memory for it.</p>