I am trying to cycle through the members of a structure using a For loop.
struct Pixel{
unsigned char = Red, Green, Blue;
};
in Main, I would like to have
const char *color[]= {"Red", "Green", "Blue};
and be able to reference the members of struct Pixel as such...
struct Pixel pixels;
pixels.color[i]; // i being the counter in the For loop
instead of
pixels.Red;
pixels.Green;
I am getting a warning saying that it not allowed. I have tried parenthesis around the color[i], but to no avail.
Is this possible or am I just wasting my time?
If so, what syntax do I need to use?
Thanks