title: How to initialise a complex C struct in one line?
body: <p>I have a structure:</p>
  
  <pre><code>typedef struct stock {
    const char* key1p2;    // stock code
    const char* key2p2;    // short desc
    const char* desc1;     // description
    const char* prod_grp;  // product group
    const char dp_inqty;   // decimal places in quantity
    const long salprc_u;   // VAT excl price
    const long salprc_e;   // VAT includive price
    const long b_each;     // quantity in stock
    const long b_alloc;    // allocated qty
    const char* smsgr_id;  // subgroup
    const char** barcodes; // barcodes
  } stock_t;
  </code></pre>
  
  <p>and I want to initialise arrays of instances of this structure, in one line of code per stock struct.</p>
  
  <p>I have tried:</p>
  
  <pre><code>stock_t data_stock[] = {
      { "0001", "Soup",  "Tomato Soup",     "71", 0, 100, 120, 10, 0, "",   {"12345", "23456", NULL} },
      { "0002", "Melon", "Melon and Ham",   "71", 0, 200, 240, 10, 0, "",   {"34567", "45678", NULL} },
      ...
      { NULL,   NULL,    NULL,              NULL, 0,   0,   0,  0, 0, NULL, NULL         }
  };
  </code></pre>
  
  <p>but it fails with:</p>
  
  <pre><code>data.c:26:74: warning: incompatible pointer types initializing 'const char **' with an expression of type 'char [6]'
        [-Wincompatible-pointer-types]
    { "0001", "Soup",  "Tomato Soup",     "71", 0, 100, 120, 10, 0, "",   {"12345", "23456", NULL} },
                                                                           ^~~~~~~
  </code></pre>
  
  <p>It is the barcode field which is problematic, as it is char**.</p>
  
  <p>(that was clang, but GCC reports a similar error, but less helpfully.)</p>
  
  <p>It's almost as if the compiler has ignored the curly brace before "12345".</p>
  
  <p>I can work around the problem using:</p>
  
  <pre><code>const char *barcodes0001[] = {"12345", "23456", NULL};
  
  stock_t data_stock[] = {
    { "0001", "Soup",  "Tomato Soup",     "71", 0, 100, 120, 10, 0, "",   barcodes0001 },
  </code></pre>
  
  <p>Is the cause of this problem a different between char <em>[] and char *</em>, or is there something more subtle.  (Perhaps you can initialise arrays of structs, but not structs of arrays.)</p>