diff options
| author | Blake Romero <blake@blkrom.com> | 2024-09-02 01:20:18 +0100 |
|---|---|---|
| committer | Blake Romero <blake@blkrom.com> | 2024-10-30 10:13:26 +0000 |
| commit | 6469b2c887716a5c6a0e191c5ffeb7972f7f7b34 (patch) | |
| tree | 9006291004faec2ce91094754fc7992a129caebf /linkedlist/main.c | |
| parent | 3773eb12e3a613cbde4890be0c1d2a9b548abf63 (diff) | |
Add initial linked list implementation
Diffstat (limited to 'linkedlist/main.c')
| -rw-r--r-- | linkedlist/main.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/linkedlist/main.c b/linkedlist/main.c new file mode 100644 index 0000000..3ba95a3 --- /dev/null +++ b/linkedlist/main.c @@ -0,0 +1,44 @@ +#include "ll.h" + +int main() { + Node* head = NEW_NODE; + int val; + + val = 7; + head->value = val; + printf("Init with %i:\t", val); + llprint(head); + + val = 12; + llpush(&head, val); + printf("Push %i:\t", val); + llprint(head); + + val = 99; + printf("Append %i:\t", val); + llappend(head,val); + llprint(head); + + val = 45; + printf("Insert %i:\t", val); + llinsert(&head, val, 2); + llprint(head); + + val = 42; + printf("Insert %i:\t", val); + llinsert(&head, val, 1); + llprint(head); + + printf("Pop %i:\t\t", llpop(&head)); + llprint(head); + + printf("Remove %i:\t",llrmlast(&head)); + llprint(head); + + printf("Remove %i:\t",llrm(&head,1)); + llprint(head); + + llvprint(head); + + llfree(head); +} |
