title: Allocating memory for a array of linked lists
body: <p>Hi guys I'm new to linked lists, but I'm pretty sure that I know how they work, theoretically, I think I might having a syntax misunderstanding, or memory management error.</p>
  
  <p>edit: My main purpose is to make a collection of lists which are indexed by the array, each array element is a head(or root) node. I'm having issues allocation dynamically this struct array.  </p>
  
  <p>What I'm doing is the following:</p>
  
  <pre><code>typedef struct item_list{
  int item_name;
  int item_supplier;
  int item_price;
  struct item_list *next
  }node; 
  
  int i;
  node ** shop_1 = (node **)malloc(shop_items_elements * sizeof(node)); 
  
  for (i=0;i&lt;=shop_items_elements;i++)
  {
      shop_1[i]-&gt;next=NULL;
  }
  </code></pre>
  
  <p>I'm getting a segmentation fault while I try to give <code>next</code> at the element <code>i</code> the value of <code>NULL</code>. </p>