-
Notifications
You must be signed in to change notification settings - Fork 0
dllist introduction
Anders Jansson edited this page Nov 27, 2016
·
2 revisions
The defined data type for a list and an element in the list are the same. So the head of the list will be able to be "part" of the list. It is not actually part of the list in the sence that it contains an element and the pointer in the data part should be NULL.
The data type is a struct that we call struct DLL
that will contain a pointer to previous element, a pointer to data and a pointer to next element. It will look like this:
struct DLL {
struct DLL* prev;
void* data;
struct DLL* next;
};
It will look like this if we draw an image:
So a list with 3 elements (that is not shown here) will look like this:
The declaration of the interface is in the src/dllist.h file, and the explanation of each function is here.