#include #include "linked_list.h" /** * free's a linked list * @param head of linked list to be freed * @return void */ void _free_linked_list(node_info *pList) { node_info *temp; while(pList->next != NULL) { temp = pList; pList = pList->next; free(temp); } } /** * returns a copy of list * @param nodeInfo list to be copied * @return copied list */ node_info *copy_linked_list(node_info *pList) { node_info *newList = malloc(sizeof(node_info)); newList->next = NULL; node_info *copy_list = newList; while(pList->next != NULL) { pList = pList->next; copy_list->next = pList; copy_list = copy_list->next; } return newList; }