title: C initialize array within structure
body: <p>I want to have an variable-length array contained within a structure, but am having trouble initializing it correctly.</p>
  
  <pre><code>struct Grid {
    int rows;
    int cols;
    int grid[];
  }
  
  int main() {
    struct Grid testgrid = {1, 3, {4, 5, 6}};
  }
  </code></pre>
  
  <p>Everything I try gives me an 'error: non-static initialization of a flexible array member' error.</p>