September 2018
Intermediate to advanced
328 pages
9h 10m
English
The second section contains the two functions used to add and delete nodes from the linked list:
void deleteNode(struct Node **headNode, struct Node *delNode) { // Base case: if (*headNode == NULL || delNode == NULL) return; // If node to be deleted is head node: if (*headNode == delNode) *headNode = delNode->next; // Change next only if node to be deleted is NOT the last node: if (delNode->next != NULL) delNode->next->prev = delNode->prev; // Change prev only if node to be deleted is NOT the first node: if (delNode->prev != NULL) delNode->prev->next = delNode->next; // Finally, free the memory occupied by delNode: free(delNode);}void appendNode(struct Node **headNode, int id, int categoryId, float rawAmount, float ...Read now
Unlock full access