C - Accessing a structure within a structure
I was doing a project in C. And I am pretty new to C. In a project I have a structure like this:
struct room_t{
char* name;
struct room_t* north;
struct room_t* east;
struct room_t* south;
struct room_t* west;
}
declared as: struct room_t room[3]
If I want to access the title in the north, I do this: room[0].north[0]->name
I'm right? or should it beroom[0].north[0].name
+3
source to share
2 answers