30 lines
453 B
C
30 lines
453 B
C
|
|
#include "node.h"
|
|
|
|
void append_node(struct node* head, struct node* node_app) {
|
|
|
|
if(!head) {
|
|
head = node_app;
|
|
return;
|
|
}
|
|
|
|
struct node* temp = head;
|
|
|
|
while(temp->node != NULL) {
|
|
temp = temp->node;
|
|
}
|
|
temp->node = node_app;
|
|
|
|
}
|
|
|
|
struct node* appendv_node(struct node* head, void* data) {
|
|
|
|
struct node* node = malloc(sizeof(struct node));
|
|
node->data = data;
|
|
node->node = NULL;
|
|
|
|
append_node(head, node);
|
|
|
|
return node;
|
|
}
|
|
|