I was just experimenting with C and i tried to put a list inside a list. The problem is that while it prints the array->count it shows a segmentation fault when i try to change the array->head->x. What i am doing wrong? I havent finished my programm yet so thats why i use a macro.
#include <stdio.h>
#include <stdlib.h>
#define N 3
typedef struct smallList{
int x;
struct smallList *next;
} smallList;
typedef struct bigList{
int count;
struct bigList *next;
smallList *head;
} bigList;
void main(void)
{
bigList *array = (bigList*)malloc(sizeof(bigList));
array->count = 3;
printf("%d \n", array->count);
array->head->x = 10;
printf("%d \n", array->head->x);
}