RubbishBin/josephus/include/LinkedList.h

83 lines
1.8 KiB
C
Raw Permalink Normal View History

2024-10-30 17:23:52 +08:00
//
// Created by ricardo on 9/26/22.
//
#ifndef JOSEPHUS_LINKED_LIST_H
#define JOSEPHUS_LINKED_LIST_H
#include "cstdlib"
#include "cstring"
#include "cstdio"
#include "define.h"
/**
*
*/
struct node {
int ID;
char Name[MAX_NAME_LENGTH];
int Age;
int Gender;
struct node* next;
};
typedef struct node node_t;
typedef struct node* node_p;
/**
*
* @param head
* @return true
* @return false
*/
bool init_linked_list(node_p& head);
/**
*
* @param head
*/
void destroy_linked_list(node_p& head);
/**
*
* @param node
* @param id
* @param age
* @param gender
* @param name
* @return true
* @return false
*/
bool create_node(node_p& node, int id, int age, int gender, char* name);
/**
*
*
* @param head
* @param new_node
*/
void append_node(const node_p& head, node_p new_node);
/**
*
* @param head
* @param target_node
* @return true
* @return false
*/
bool delete_node(const node_p& head, node_p target_node);
/**
*
* @param node
*/
void print_node(const node_p& node);
/**
*
* @param head
*/
void print_linked_list(const node_p& head);
#endif //JOSEPHUS_LINKED_LIST_H