title: malloc an array of struct pointers vs array of structs
body: <p>What's the difference between</p>
  
  <pre><code>struct mystruct *ptr = (struct test *)malloc(n*sizeof(struct test));
  </code></pre>
  
  <p>and</p>
  
  <pre><code>struct mystruct **ptr = (struct test *)malloc(n*sizeof(struct test *));
  </code></pre>
  
  <p>They both work fine, I'm just curious about the actual difference between the two. Does the first one allocate an array of structs, whereas the second one an array of struct pointers? The other way around? Also, which one has a smaller memory footprint?</p>