-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.h
32 lines (25 loc) · 902 Bytes
/
list.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef LIST_H
#define LIST_H
typedef struct listnode
{
struct listnode * next;
int value;
} Node;
Node * List_insert(Node * head, int v);
/* insert a value v to a linked list starting with head, return the
* new head */
Node * List_search(Node * head, int v);
/* search a value in a linked list starting with head, return the node
* whose value is v, or NULL if no such node exists */
Node * List_delete(Node * head, int v);
/* delete the node whose value is v in a linked list starting with
* head, return the head of the remaining list, or NULL if the list is
* empty */
void List_destroy(Node * head);
/* delete every node */
void List_print(Node * head);
/* print the values stored in the linked list */
Node * List_insert_last(Node * head, int v);
/* insert a value v to the end of a linked list starting with head, returns
* a pointer to the new node */
#endif