title: How to initialize a structure with flexible array member
body: <p>I have the following structure</p>
  
  <pre><code>typedef struct _person {
      int age;
      char sex;
      char name[];
  }person;
  </code></pre>
  
  <p>I have done some basic internet search (but unsuccessful) on how to create an instance and initialize a structure with a flexible array member without using <code>malloc()</code>.</p>
  
  <p>For example: for normal structures like </p>
  
  <pre><code>struct a {
      int age; 
      int sex;
  };
  </code></pre>
  
  <p>We can create an instance of <code>struct a</code> and initialize it like</p>
  
  <pre><code>struct a p1 = {10, 'm'};
  </code></pre>
  
  <p>But for structures with flexible array in it (like <code>_person</code> as mentioned above) how can we create an instance and initialize like how we do it for normal <code>structures</code>?</p>
  
  <p>Is it even possible? If so, how do we pass the array size during the initialization and the actual value to be initialized?</p>
  
  <p>(or) </p>
  
  <p>Is it true that the only way to create a structure with flexible array is using <code>malloc()</code> as mentioned in C99 specification - <code>6.7.2.1 Structure and union specifiers - point #17</code>?!</p>