1

I defined the following struct:

struct Color {
    unsigned int r, g, b, a;
};

Is there a way to cycle through its elements like:

Color c;

for (unsigned int i "in all struct elements") {
    c.i = 0;
}

So that, after that, all 4 unsigned int in c are set to 0?

tenfour
  • 35,101
  • 13
  • 77
  • 137

1 Answers1

1

Just use something like

Color color;
color = { 0 };
Vlad from Moscow
  • 265,791
  • 20
  • 170
  • 303