DSA Hacking Club Library
Loading...
Searching...
No Matches
linkedlist.h
Go to the documentation of this file.
1
11
12#ifndef LINKEDLIST_H
13#define LINKEDLIST_H
14
15#include <stdio.h>
16
22typedef struct node {
23 int value;
24 struct node *next;
26
34void printlist(node_t *head);
35
46
56node_t *insert_at_head(node_t **head, node_t *node_to_insert);
57
67node_t *find_node(node_t *head, int value);
68
77void insert_after_node(node_t *node_to_insert_after, node_t *newnode);
78
87void free_list(node_t *head);
88
89#endif // LINKEDLIST_H
void printlist(node_t *head)
Prints all the values in the linked list.
Definition linkedlist.c:14
void insert_after_node(node_t *node_to_insert_after, node_t *newnode)
Inserts a new node after a given node.
Definition linkedlist.c:48
node_t * find_node(node_t *head, int value)
Finds the first node with a given value.
Definition linkedlist.c:38
node_t * create_new_node(int value)
Creates a new node with a given integer value.
Definition linkedlist.c:24
void free_list(node_t *head)
Frees all nodes in the linked list.
Definition linkedlist.c:5
node_t * insert_at_head(node_t **head, node_t *node_to_insert)
Inserts a node at the head of the list.
Definition linkedlist.c:32
struct node node_t
A node in the singly linked list.
A node in the singly linked list.
Definition linkedlist.h:22
struct node * next
Pointer to the next node in the list.
Definition linkedlist.h:24
int value
The integer value stored in the node.
Definition linkedlist.h:23