2023-10-12 14:25:48 -07:00
|
|
|
#include "stdlib.h"
|
|
|
|
|
|
|
|
#ifndef NODES
|
|
|
|
#define NODES
|
|
|
|
|
|
|
|
struct node {
|
|
|
|
struct node* node;
|
|
|
|
void* data;
|
|
|
|
};
|
|
|
|
|
2023-10-15 16:11:39 -07:00
|
|
|
// Appends Node to list
|
2023-10-12 14:25:48 -07:00
|
|
|
void append_node(struct node*, struct node*);
|
|
|
|
|
2023-10-15 16:11:39 -07:00
|
|
|
// Creates node with value and appends
|
|
|
|
// Returns node that was created
|
2023-10-12 14:25:48 -07:00
|
|
|
struct node* appendv_node(struct node*, void*);
|
|
|
|
|
2023-10-15 16:11:39 -07:00
|
|
|
// Counts the number of nodes in a list
|
2023-10-13 01:39:26 -07:00
|
|
|
int count_nodes(struct node*);
|
2023-10-12 14:25:48 -07:00
|
|
|
|
2023-10-15 16:11:39 -07:00
|
|
|
// Iterates over every node in a list and runs the given function
|
2023-10-13 03:29:13 -07:00
|
|
|
void iterate_nodes(struct node*, void *func(void*, void*), void*);
|
|
|
|
|
2023-10-12 14:25:48 -07:00
|
|
|
#endif
|