C structs NxN intersection -
this question has answer here:
- self referential struct definition? 9 answers
i have script
a.h #include b.h typedef struct b b; typedef struct a; struct a{ val1; b val2; } b.h #include a.h typedef struct b b; typedef struct a; struct b{ val1; b val2; } how can make work?
can create val1 , give him val1.val2=xx val1.val2.val1=xx or val2.val1=xx isn't working.
you're trying create struct contains copy of itself. can't work. can create pointer itself:
typedef struct b b; typedef struct a; struct b{ *val1; b *val2; };
Comments
Post a Comment