From 00d25de4d9a75aa20bc8aaa58b5570f3b0cd6570 Mon Sep 17 00:00:00 2001 From: Lukas Heiligenbrunner Date: Tue, 28 Apr 2020 19:21:20 +0000 Subject: [PATCH] Upload New File --- chained_list.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 chained_list.c diff --git a/chained_list.c b/chained_list.c new file mode 100644 index 0000000..2443500 --- /dev/null +++ b/chained_list.c @@ -0,0 +1,59 @@ +/* + ============================================================================ + Name : chained_list.c + Author : Lukas Heiligenbrunner + Version : 0.1.5 BETA + Copyright : My copyright + Description : C programme to manage chained lists + ============================================================================ + */ + +#include +#include +#include "chained_functions.h" + +int +main (void) +{ + + messdaten * head; + messdaten * erste; + messdaten * zweite; + messdaten * dritte; + dr + + head = malloc (sizeof(messdaten)); + erste = malloc (sizeof(messdaten)); + zweite = malloc (sizeof(messdaten)); + dritte = malloc (sizeof(messdaten)); + if (head == NULL || erste == NULL || zweite == NULL || dritte == NULL) + { + return 1; + } + + insertLast (head, dritte); + insertPos (head, erste, 1); + insertPos (head, zweite, 2); + + erste->messwert = 1; + zweite->messwert = 2; + dritte->messwert = 3; + head->messwert = 42; + + printf ("Messwert von head: >%f<\n", head->messwert); + printf ("Messwert von head next: >%f<\n", head->next->messwert); + printf ("Messwert von head next next: >%f<\n", head->next->next->messwert); + printf ("Messwert von head next next: >%f<\n\n", + head->next->next->next->messwert); + + printf ("Messwert von head >%f<\n", head->messwert); + printf ("Messwert von erste: >%f<\n", erste->messwert); + printf ("Messwert von zweite: >%f<\n", zweite->messwert); + printf ("Messwert von zweite: >%f<\n", dritte->messwert); + + deleteLast (head); + deleteLast (head); + deleteLast (head); + + return EXIT_SUCCESS; +}