title: Initializing an array of structs in C using Macros with an array parameter
body: <p>I am attempting to use a macro to initialize all the array parameters of a structure array where one of the parameters is an array.</p>
  
  <p>My struct is </p>
  
  <pre><code>typedef struct
  {
    int size_parts;
    int *parts;
    int width;
    int length;
  } parts_struct;
  </code></pre>
  
  <p>And my macro is defined as</p>
  
  <pre><code>#define SET_ARRAY_INPUT(_width, _length, ...) {width:_width, length:_length, parts:{__VA_ARGS__}, size_parts:(sizeof((int[]){__VA_ARGS__})/sizeof(int))}
  </code></pre>
  
  <p>My array is initialized as</p>
  
  <pre><code>static parts_struct parts[] = {
     SET_ARRAY_INPUT(2, 3, 9354, 39458, 3294),
     SET_ARRAY_INPUT(4, 2, 9354, 3294)
  }
  </code></pre>
  
  <p>However this is always failing and I keep getting error "error: braces around scalar initializer for type". Any help would be greatly appreciated.</p>