mercredi 4 mars 2020

Cycle through struct elements [duplicate]

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?





Aucun commentaire:

Enregistrer un commentaire