typedef struct foo_s { int a; } foo; typedef struct bar_s { foo; int b; } bar;
Essentially I want to do:
bar b; b.a; <
It can be easily done via preprocessor:
Create a file named base_foo.h:
base_foo.h
int foo;
Then simply include it:
typedef struct foo_s { #include "base_foo.h" } foo; typedef struct bar_s { #include "base_foo.h" int b; } bar;