1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "ll.h"
4 
myfunc(void * data)5 void myfunc(void *data) {
6 	char *t;
7 	t = (char *) data;
8 	printf("GOT data = %s\n",t);
9 	free(t);
10 }
11 
12 
main()13 int main() {
14 	LL l = CreateLL();
15 	LL z = CreateLL();
16 	LLE e;
17 	char *b;
18 	FreeLL(z);
19 	SetFreeLLE(l,&myfunc);
20 	b = (char *) malloc(1000);
21 	strcpy(b,"I like you, you like me");
22 	AddToLL(l,"1",b);
23 	b = (char *) malloc(1000);
24 	strcpy(b,"or maybe not?");
25 	AddToLL(l,"2",b);
26 	b = (char *) malloc(1000);
27 	strcpy(b,"I hope you do at least!@$");
28 	AddToLL(l,"3",b);
29 	b = (char *) malloc(1000);
30 	strcpy(b,"8if you dont, why the fuxor not1@$");
31 	AddToLL(l,"4",b);
32 	ResetLLPosition(l);
33 	while ( (e = GetNextLLE(l)) ) {
34 		printf("key = %s, data = %s\n",e->key,(char *)e->data);
35 	}
36 	printf("Going to TLL Traversal\n");
37 	for ( TLL(l,e) ) {
38 		printf("key = %s, data = %s\n",e->key,(char *)e->data);
39 	}
40 	ResetLLPosition(l);
41 	e = FindInLL(l,"3");
42 	printf("result of find = %s\n",(char *)e->data);
43 	RemoveFromLLByKey(l,"2");
44         while ( (e = GetNextLLE(l)) ) {
45                 printf("key = %s, data = %s\n",e->key,(char *)e->data);
46         }
47 	e = FindInLL(l,"9");
48 	if ( e ) {
49 		printf("Found 9\n");
50 	} else {
51 		printf("didnt find key 9\n");
52 	}
53 	FreeLL(l);
54 	printf("l is freed, all good!\n");
55 	l = CreateLL();
56 	printf("back here\n");
57 	printf("%d\n",sizeof(struct _lle));
58 	printf("%d\n",sizeof(LLE));
59 	return 1;
60 }
61