view README @ 4:c9e6f5c0a9b2

Added copyright notices, COPYING and README files.
author Eris Caffee <discordia@eldalin.com>
date Fri, 22 Jul 2011 20:45:30 -0500
parents
children
line source
1 To use this class, simiply include the the LinkedList.h and LinkedList.c files in the sources of your project.
3 The main.c file is a test driver program that also demonstrates how the code can be used. It shows two different access modes.
6 The first access method uses traditional C syntax.
8 LinkedList list;
9 int * p_int;
10 int ;
12 ll_init(&list); // "Constructor"
14 for (i=0; i<10; ++i)
15 {
16 p_int = malloc(sizeof(int));
17 *p_int = i;
18 ll_push(&list1, p_int);
19 }
21 This is actually my preferred method of use.
25 The second usage mode emulates C++ style dot notation to access methods.
27 LinkedList list;
28 int * p_int;
29 int ;
31 ll_init(&list); // "Constructor"
33 for (i=0; i<10; ++i)
34 {
35 p_int = malloc(sizeof(int));
36 *p_int = i;
37 list1.push(&list1, p_int);
38 }
40 Note that even though the method is accessed via dot notation, you still have to explicitly pass the list as the first argument to set the "this" pointer in the method. This isn't very friendly, I suppose, but I've not come up with anything better.
44 Eris Caffee
45 discordia@eldalin.com