I'm new to C, and I'm trying to write simple schedule program. I have rooms and want to fill them with events.
static void create_dummy_data()
{
#define max_entries 5
struct event
{
char *event_name;
int duration_min; // duration in minutes
};
struct room
{
char *room_name;
struct event *events[10];
};
int i = 0;
char *names[] = {"Room1", "Room2", "Room3", "Room4", "Room5", "Room6"};
struct room *rooms[max_entries];
for ( i = 0; i < max_entries ; i++)
{
rooms[i]->room_name = names[i]; // The problem is here
}
}
I'm getting error "8263 segmentation fault (core dumped)"