I'd like to keep my keywords in a struct:
typedef const char* label;
const struct keywords_t
{
label init;
label moveUnit;
} keywords;
But I'd like to be able to check whether a keyword is valid with a for loop, so I tried to initialize the struct like this:
const label allowed_keywords[] =
{
"INIT",
"MOVE"
};
const struct keywords_t keywords =
{
allowed_keywords[0],
allowed_keywords[1]
};
This gives me an
error: initializer element is not constant
What am I doing wrong? The whole array is constant, though.