The error means that you try and add a member to the struct
of a type that isn't fully defined yet, so the compiler cannot know its size in order to determine the objects layout.
In you particular case, you try and have struct Cat
hold a complete object of itself as a member (the mother
field). That sort of infinite recursion in type definition is of course impossible.
Nevertheless, structures can contain pointers to other instances of themselves. So if you change your definition as follows, it will be a valid struct
:
struct Cat{
char *name;
struct Cat *mother;
struct Cat *children;
};