title: What is the cause of flexible array member not at end of struct error?
body: <p>I am wondering why I keep getting <code>error: flexible array member not at end of struct</code> error when I call malloc. I have a struct with a variable length array, and I keep getting this error.</p>
  
  <p>The struct is,</p>
  
  <pre><code>typedef struct {
    size_t N;
    double data[];
    int label[];
  } s_col; 
  </code></pre>
  
  <p>and the call to malloc is,</p>
  
  <pre><code>col = malloc(sizeof(s_col) + lc * (sizeof(double) + sizeof(int)));
  </code></pre>
  
  <p>Is this the correct call to malloc?</p>