title: Initialization of dynamic array of structs
body: <p>This is my struct:</p>
  
  <pre><code>typedef struct ElementToInsert {
      char *key;
      char *value;
  } element;
  </code></pre>
  
  <p>This is my function:</p>
  
  <pre><code>void init_hash(int size, element**arr) {
      *arr = malloc(size * sizeof(element*));
      if (arr == NULL)
      {
          printf("Out of memory\n");
          return 0;
      }
      for (int i = 0; i &lt; size; i++) {
  
          (*arr)[i].key = NULL;
          (*arr)[i].value = NULL;
      }
  
  }
  </code></pre>
  
  <p>And the <code>main()</code>:</p>
  
  <pre><code>void main() {
      element *hash_table = NULL;
      int hash_table_size = 10;
      init_hash(hash_table_size, &amp;hash_table);
  }
  </code></pre>
  
  <p>The problem is that when I run the debugger (in visual studio 2015) it doesn't show me all the array values. I expect to see something like: <code>hash_table[0] = {key = NULL, value = NULL}, hash_table[1] = {key = NULL, value = NULL}</code> but all I see is this:</p>
  
  <p><a href="https://i.stack.imgur.com/a9t94.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a9t94.jpg" alt="enter image description here"></a></p>