Skip to content
Snippets Groups Projects
Select Git revision
  • main default protected
  • uebung-12
  • uebung-11
  • uebung-10
  • uebung-09
  • uebung-08
  • uebung-07
  • uebung-06
  • uebung-05
  • uebung-04
  • uebung-03
  • uebung-01
12 results

test

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    linked_list.h 978 B
    #ifndef LINKED_LIST_H
    #define LINKED_LIST_H
    
    #include <stddef.h>
    
    typedef int ll_data_t;
    struct list;
    
    // constructs a new (empty) list
    struct list *list_create(void);
    
    // counts the items on a list
    size_t list_count(const struct list *list);
    
    // inserts item at back of a list
    void list_push(struct list *list, ll_data_t item_data);
    
    // removes item from back of a list
    ll_data_t list_pop(struct list *list);
    
    // inserts item at front of a list
    void list_unshift(struct list *list, ll_data_t item_data);
    
    // removes item from front of a list
    ll_data_t list_shift(struct list *list);
    
    // deletes a node that holds the matching data
    void list_delete(struct list *list, ll_data_t data);
    
    // destroys an entire list
    // list will be a dangling pointer after calling this method on it
    void list_destroy(struct list *list);
    
    // handle allocation failure
    void alloaction_failure(void);
    
    // helper function for creating bare node
    struct list_node *create_node(ll_data_t data); 
    
    #endif