Re: storing related structs



Grey Alien wrote:

Army1987 wrote:

<snip></snip>
struct C {
unsigned id;
char name; /* do you mean *name, or name[LARGE_ENOUGH]? */
enum { strA, strB } type;
Why have you declared an enum here? ^ (can't see why this is needed)


So you can record whether this union ...
union {
struct A str_A;
struct B str_B;
} the_struct;

.... is currently supposed to be an A or a B.

};

As far as solutions go, I think we don't know what problem
you're trying to solve, only the C context you're trying
to solve it in. It may make a difference.

--
Pressure Hedgehog
The "good old days" used to be much better.

.



Relevant Pages