blob: 4544d2eeeecdd31f1e5de88514547ccd7444ebea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include <stdio.h>
#include "dll.h"
int main(){
dll_t *head = dllalloc();
dllsetdata(head, "hello");
for (int i = 0; i < 3; i++){
dll_t *node = dllalloc();
dllsetdata(node, "hi");
dllsetnext(head, node);
}
for (int i = 0; i < 4; i++)
printf("%s\n", (char *)dllgetat(head, i));
printf("%s\n", (char *)head->prev->next->data);
dllfreeall(head);
}
|