X-Git-Url: http://git.harvie.cz/?p=svn%2FCll1h%2F.git;a=blobdiff_plain;f=demos%2Fansi-c%2Ffloat-list-plain-c.c;fp=demos%2Fansi-c%2Ffloat-list-plain-c.c;h=0000000000000000000000000000000000000000;hp=0501873547280de9143f0f9e644b9556a5044f53;hb=e63f1bc2438012b5f2f6592a474892501149af18;hpb=6a60bc82e8b8e6cccd0d4c2214a1f291662215f0 diff --git a/demos/ansi-c/float-list-plain-c.c b/demos/ansi-c/float-list-plain-c.c deleted file mode 100644 index 0501873..0000000 --- a/demos/ansi-c/float-list-plain-c.c +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include - - -struct Node -{ - float f; - struct Node* next; -}; - -void IterateList (struct Node* HeadList); -struct Node* makelist(struct Node** Head, struct Node** Tail); - -struct Node* makelist(struct Node** Head, struct Node** Tail) -{ - struct Node* new = (struct Node *)malloc(sizeof (struct Node)); - new->next = NULL; - - if (*Head == NULL) - { - *Head = new; - *Tail = *Head; - } - else - { - (*Tail)->next = new; - *Tail = new; - } - return (new); -} -void IterateList (struct Node* HeadList) -{ - struct Node* current = HeadList; - - while (current != NULL) - { - printf("The float you entered is %f\n",current->f); - current = current->next; - } -} -int main(void) -{ - struct Node* head = NULL; - struct Node* tail = NULL; - struct Node* curr = NULL; - int i; - - for(i=0; i < 20; i++) - { - /* create node */ - curr = makelist(&head,&tail); - printf("Enter float :\n"); - scanf("%f", &(curr->f)); - } - - /* now iterate the list */ - IterateList(head); - - return 0; -}