title: Segmentation fault in assigning value to a dynamic array of Nodes, inside a structure
body: <p>I am trying to create a Hash Map in C. Below is the code. When I try to 
  assign value to the elements of Darray ( each of which is a pointer to a Node) I am getting a segmentation fault ( i.e. at line 23 and24). Could anybody help in pointing out where am I going wrong. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  typedef struct Node {
      int data;
      struct Node* next;
  }Node;
  
  typedef struct Map{
      struct Node** Darray;
  } Map;
  
  #define SIZE 10
  int main()
  {
      int i=0;
      Map* M = malloc(sizeof(Map));
      M-&gt;Darray = (struct Node**)malloc(sizeof(Node*)*SIZE);
      for (i =0;i &lt; SIZE;i++){
          M-&gt;Darray[i]-&gt;data =0;
          M-&gt;Darray[i]-&gt;next =NULL;
      }
  }
  </code></pre>