Below is the C program I have written. It contains an implementation of the doubly linked list.
#include <stdio.h>
/* node of a doubly linked list */
typedef struct _dlnode {
struct _dlnode* prev;
int key;
struct _dlnode* next;
} dlnode;
/* doubly linked list */
typedef struct _dllist {
dlnode* head;
dlnode* tail;
} dllist;
/* returns an empty doubly linked list */
dllist* empty_dllist () {
dllist* l;
l->head=NULL;
l->tail=NULL;
return l;
}
int main()
{
dllist* l;
l=empty_dllist ();
return 0;
}
I get the following runtime error:
Segmentation fault: 11
What is it caused by?