Hey guys, stupid syntax question here.
I'm defining a structure with a few array members which I'm trying to initialize by using a declaration list. It is not working and according to google it seems not to be legal syntax in c.
The alternative is to declare the members inside a different structure as non-array types, and then declare an array of members inside another the struct, but that complicates my interfacing code a bit.
Here's my original illegal code to give some semblance of meaning to my ramble
Code:
typedef struct s_format_groups
{
const char specifier[][16] =
{
{'d', 'D' 'i', 'O', 'u', 'U', 'x', 'X'},
{'s', 'S', 'c', 'C'},
{'p'}
};
const char length[] = {'h', 'l', 'j', 'z'}; // remember to account for "hh" && "ll" maybe define MAX_COUNT 2 as the max number of flag repeats
const char flags[] = {'-', '+', ' ', '#', '0'};
const char width[] = {'*'};
const char precision[] = {'.'};
} t_format_groups;
What would be a good way to achieve what I'm trying to do?