title: Allocating an Array of Structs without Malloc?
body: <p>I have a struct defined in this way.</p>
  
  <pre><code>typedef struct COUNTRY {
      char Code[3];
      char Country[30];
      int Population;
      float Expectancy;
      struct Country *Pointer;
  } COUNTRY;
  </code></pre>
  
  <p>I have seen an array of structs allocated like this:</p>
  
  <pre><code>COUNTRY *countries = calloc(128, sizeof(COUNTRY));
  </code></pre>
  
  <p>or maybe like this:</p>
  
  <pre><code>COUNTRY *countries = malloc(128 * sizeof(COUNTRY));
  </code></pre>
  
  <p>But what does this do:</p>
  
  <pre><code>COUNTRY countries[128] = {};
  </code></pre>
  
  <p>Because I am still able to write to each entries' fields in all cases. Is the third option just bad form? It seems better to me because you can put that line up with the rest of your variable declarations <em>outside</em> of main(). Otherwise, you can only calloc() or malloc() inside of main() or other function.</p>
  
  <p>Am I doing something wrong?</p>