In the for loop below I attempt to access an array of structures stored in another structure but I continue to get an error that says. "struct list has no member head."
list* createList(int size)
{
list* graph = malloc(sizeof(list));
graph->size = size;
graph->array = malloc(size * sizeof(vertex));
int i;
for(i=0; i < size;i++){
graph->array[i].head = NULL;
return graph;
}
}
The structures I am attempting to use are as follows.
struct vertex
{
struct vertex *head;
};
typedef struct vertex vertex;
And
struct list
{
int size;
struct list* array;
};
typedef struct list list;
list'sarraymember should be astruct vertex*. Otherwise, I don't see anyvertexin your code.