returns a pointer the given item index in a list Returns NULL if point not found
| 134 | // returns a pointer the given item index in a list |
| 135 | // Returns NULL if point not found |
| 136 | void *GetListItem(listnode **listp, int index) { |
| 137 | listnode *node; |
| 138 | |
| 139 | for (node = *listp; node != NULL; node = node->next) { |
| 140 | if (index-- == 0) |
| 141 | return node->data; |
| 142 | } |
| 143 | |
| 144 | return NULL; |
| 145 | } |
| 146 | |
| 147 | // Returns how far from the head of the list a given item is |
| 148 | // Returns -1 if not found |