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
  • 36,141
  • 15
  • 83
  • 142

1 Answers1

1

Just use something like

Color color;
color = { 0 };
Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335