The compiler will accept the code, for example your example:
typedef struct Data { int x; int y; struct BlaBla * next; }List;
This is normal because the size of the pointers is known to the compiler, and the compiler assumes that the structure will be defined before it is dereferenced.
Since the compiler acts in this way, this can be done:
typedef struct Data { int x; int y; struct Data * next; } List;
However, if you must enable struct inline, like this:
typedef struct Data { int x; int y; struct BlaBla blaStruct; }List;
The compiler cannot decide how large the struct Data is because it does not know how large the struct BlaBla . To get this for compilation, you need to include the struct BlaBla .
Note that as soon as you need to access the members of the struct BlaBla , you will need to specify a header file that defines it.
source share