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.
My struct is
typedef struct
{
int size_parts;
int *parts;
int width;
int length;
} parts_struct;
And my macro is defined as
#define SET_ARRAY_INPUT(_width, _length, ...) {width:_width, length:_length, parts:{__VA_ARGS__}, size_parts:(sizeof((int[]){__VA_ARGS__})/sizeof(int))}
My array is initialized as
static parts_struct parts[] = {
SET_ARRAY_INPUT(2, 3, 9354, 39458, 3294),
SET_ARRAY_INPUT(4, 2, 9354, 3294)
}
However this is always failing and I keep getting error "error: braces around scalar initializer for type". Any help would be greatly appreciated.