Added section on 'dir2atr' now that there's an "official" download.
[contiki-2.x.git] / doc / example-list.c
blob179fa2f9bd8da31c907f8ca71d02359136f9525d
1 #include "lib/list.h"
3 struct example_list_struct {
4 struct *next;
5 int number;
6 };
8 LIST(example_list);
10 static struct example_list_struct element1, element2;
12 void
13 example_function(void)
15 struct example_list_struct *s;
17 list_init(example_list);
19 element1.number = 1;
20 list_add(example_list, &element1);
22 element2.number = 2;
23 list_add(example_list, &element2);
25 for(s = list_head(example_list);
26 s != NULL;
27 s = list_item_next(s)) {
28 printf("List element number %d\n", s->number);