Advertisement
ProToTN

main.c

May 12th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.94 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "header.h"
  4.  
  5. void addToHead(LDC *list)
  6. {
  7.      llist *newCel = malloc(llist);
  8.      
  9.      newCel->next = list;
  10. }
  11.  
  12.  
  13. void addToList(LDC *list)
  14. {
  15.     int choix2 = 0;
  16.  
  17.     do
  18.     {
  19.         printf("Choix: 1: Add to the list\n2: Remove from the list");
  20.         scnaf("%d",&choix);
  21.     }while((choix <= 0)|| (choix >2));
  22.  
  23.     switch(choix2)
  24.     {
  25.         case 1: addToHead(list);
  26.                 break;
  27.         case 2: addToTail(list);
  28.                 break;
  29.     }
  30. }
  31.  
  32.  
  33.  
  34.  
  35. void main()
  36. {
  37.  
  38.     LDC *list;
  39.     list->next = NULL;
  40.     list->prev = NULL;
  41.    
  42.     int choix = 0;
  43.     do
  44.     {
  45.         printf("Choix: 1: Add to the list\n2: Remove from the list");
  46.         scanf("%d",&choix);
  47.     }while((choix <= 0)|| (choix >3));
  48.  
  49.     switch(choix)
  50.     {
  51.         case 1: addToList(list);
  52.                 break;
  53.  
  54.         case 2: removeFromList(list);
  55.                 break;
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement