linked_list.h 508 B

1234567891011121314151617181920212223
  1. #ifndef _LINKED_LIST_H_
  2. #define _LINKED_LIST_H_
  3. typedef enum {
  4. LIST_OK = 0,
  5. LIST_CANT_ALLOCATE = -1,
  6. LIST_NO_NODE = -2,
  7. } LinkedListStatus;
  8. struct ListNode_t {
  9. struct ListNode_t* previous;
  10. struct ListNode_t* next;
  11. void* data;
  12. };
  13. int getLength(const struct ListNode_t* root);
  14. LinkedListStatus addNode(struct ListNode_t** root, void* data);
  15. LinkedListStatus removeNode(struct ListNode_t** root, const void* data);
  16. LinkedListStatus removeAllNodes(struct ListNode_t** root);
  17. #endif