diff options
| author | Blake Romero <blake@developercraft.com> | 2025-10-13 23:24:07 +0100 |
|---|---|---|
| committer | Blake Romero <blake@developercraft.com> | 2025-10-13 23:24:07 +0100 |
| commit | 7d3cb09072e0a181560b8ce060c1eb09a1fb17a7 (patch) | |
| tree | f8f99c2bf077b9f03d7f66a25e11a19f9f197d5d /src/main.c | |
| parent | 3a6d7fdfcfe7fe1fa1c09788287e1b005a85a71e (diff) | |
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 35 |
1 files changed, 19 insertions, 16 deletions
@@ -5,18 +5,18 @@ void linkedlist_demo() { int val = 7; Node* head = node_init(val); - /* printf("Init with %i:\t", val); */ - /* list_print(head); */ + printf("Init with %i:\n", val); + list_print(head); - /* val = 12; */ - /* list_push(&head, val); */ - /* printf("Push %i:\t", val); */ - /* list_print(head); */ + val = 12; + list_push(&head, val); + printf("Push %i:\n", val); + list_print(head); - /* val = 99; */ - /* printf("Append %i:\t", val); */ - /* list_append(head,val); */ - /* list_print(head); */ + val = 99; + printf("Append %i:\n", val); + list_append(&head,val); + list_print(head); /* val = 45; */ /* printf("Insert %i:\t", val); */ @@ -39,11 +39,14 @@ void linkedlist_demo() { /* list_vprint(head); */ - head->next = node_init(14); - head->next->next = node_init(22); - list_free(&head); - list_print(head); + /* head->next = node_init(14); */ + /* head->next->next = node_init(22); */ + /* list_free(&head); */ + /* list_print(head); */ + printf("Length: %i\n", list_length(head)); + int i=2; + printf("list position %i: %i\n", i, list_get(head,i)); } void array_demo() { @@ -74,8 +77,8 @@ void array_demo() { } int main() { - /* linkedlist_demo(); */ + linkedlist_demo(); /* array_demo(); */ - puts("Helist_o from main"); + /* puts("Hello from main"); */ return 0; } |
