-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.c
More file actions
27 lines (21 loc) · 681 Bytes
/
main.c
File metadata and controls
27 lines (21 loc) · 681 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "linked_list.c"
#include <stdio.h>
// Main function to test the linked list
int main() {
// Create a new linked list with a NULL head pointer
struct Node* head = NULL;
// Insert nodes with values 1, 2, 3, and 4 into the list
insertAtEnd(&head, 1);
insertAtBeginning(&head, 2);
insertAtEnd(&head, 3);
insertAfter(head->next, 4);
// Print the original linked list
printf("Original linked list: ");
printList(head);
// Delete the node with key value 3 from the list
deleteNode(&head, 3);
// Print the updated linked list
printf("Linked list after deleting node with key 3: ");
printList(head);
return 0;
}