doubleChainedList/double_chained_list.c
2020-04-28 21:25:03 +02:00

56 lines
1.5 KiB
C
Executable File

/*
============================================================================
Name : double_chained_list.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include "double_chained_functions.h"
int main (void)
{
messdaten * head;
messdaten * erste;
messdaten * zweite;
messdaten * dritte;
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 EXIT_FAILURE;
}
head = insertLast (head, dritte);
head = insertPos (head, erste, 1);
head = insertPos (head, zweite, 2);
erste->data.messwert = 42;
zweite->data.messwert = 2;
dritte->data.messwert = 3;
printf ("Messwert von head: >%f<\n", head->data.messwert);
printf ("Messwert von head next: >%f<\n", head->next->data.messwert);
printf ("Messwert von head next next: >%f<\n",
head->next->next->data.messwert);
printf ("Messwert von head next next: >%f<\n\n",head->next->next->next->data.messwert);
printf ("Messwert von head >%f<\n", head->data.messwert);
printf ("Messwert von erste: >%f<\n", erste->data.messwert);
printf ("Messwert von zweite: >%f<\n", zweite->data.messwert);
printf ("Messwert von zweite: >%f<\n", dritte->data.messwert);
deleteAll (head);
return EXIT_SUCCESS;
}