60 lines
1.5 KiB
C
60 lines
1.5 KiB
C
|
/*
|
||
|
============================================================================
|
||
|
Name : chained_list.c
|
||
|
Author : Lukas Heiligenbrunner
|
||
|
Version : 0.1.5 BETA
|
||
|
Copyright : My copyright
|
||
|
Description : C programme to manage chained lists
|
||
|
============================================================================
|
||
|
*/
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#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;
|
||
|
}
|