storing related structs



I have two related structs:


struct A
{
int x ;
void * data ;
};

and

struct B
{
int x, y ;
double z ;
void * data1, *data2 ;
};


These structures (not pointers to them), need to be stored in a another struct:

struct C
{
unsigned id ;
char name ;

DATA_TYPE the_struct ;
};


Where DATA_TYPE is EITHER a struct A or struct B.

For compatability with existing libraries, I cannot use a void * (for instance), and cast between struct A and B.


Is there a soln to this problem ?
.



Relevant Pages