linked list api (doubly linked, track head and tail)
list.h@0:4212f9128c1b, 2012-10-11 (annotated)
- Committer:
- lucoby
- Date:
- Thu Oct 11 18:55:02 2012 +0000
- Revision:
- 0:4212f9128c1b
initial
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lucoby | 0:4212f9128c1b | 1 | #ifndef LIST_H |
lucoby | 0:4212f9128c1b | 2 | #define LIST_H |
lucoby | 0:4212f9128c1b | 3 | #include "mbed.h" |
lucoby | 0:4212f9128c1b | 4 | |
lucoby | 0:4212f9128c1b | 5 | typedef struct _lnode{ |
lucoby | 0:4212f9128c1b | 6 | int row; |
lucoby | 0:4212f9128c1b | 7 | int col; |
lucoby | 0:4212f9128c1b | 8 | struct _lnode* next; |
lucoby | 0:4212f9128c1b | 9 | struct _lnode* prev; |
lucoby | 0:4212f9128c1b | 10 | } Lnode; |
lucoby | 0:4212f9128c1b | 11 | |
lucoby | 0:4212f9128c1b | 12 | |
lucoby | 0:4212f9128c1b | 13 | typedef struct _list{ |
lucoby | 0:4212f9128c1b | 14 | Lnode* head; |
lucoby | 0:4212f9128c1b | 15 | Lnode* tail; |
lucoby | 0:4212f9128c1b | 16 | } List; |
lucoby | 0:4212f9128c1b | 17 | |
lucoby | 0:4212f9128c1b | 18 | void addToHead(List* list, int row, int col); |
lucoby | 0:4212f9128c1b | 19 | void removeFromTail(List* list); |
lucoby | 0:4212f9128c1b | 20 | void deleteList(List* list); |
lucoby | 0:4212f9128c1b | 21 | |
lucoby | 0:4212f9128c1b | 22 | #endif |