You can't use the structure type t_room
to define the type t_room
itself because it is not yet defined. Therefore you should replace this
t_room *connect;
with
struct s_room *connect;
Or you can typedef
struct s_room
type before actually defining struct s_room
. Then you can use the type alias in the definition.
// struct s_room type is not defined yet.
// create an alias s_room_t for the type.
typedef struct s_room s_room_t;
// define the struct s_room type and
// create yet another alias t_room for it.
typedef struct s_room {
// other data members
s_room_t *connect;
// note that type of connect is not yet defined
// because struct s_room of which s_room_t is an alias
// is not yet fully defined.
} t_room;
// s_room_t and t_room are both aliases for the type struct s_room
Personally, I'd prefer the former because to do the latter, you have to introduce one extra typedef
just to define the other typedef
! This looks like namespace clutter without any real benefit.