Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. /*
  2. CONTENU : file.c
  3. AUTEUR : ONILLON Aimeric
  4. CREATION : 13/12/2017
  5. MODIFICATION : 13/12/2017
  6. */
  7.  
  8. // librairies
  9. #include "file.h"
  10. #include <stdbool.h>
  11.  
  12. file init_file()
  13. {
  14. file f;
  15. f.head = 0;
  16. f.tail = 0;
  17. return f;
  18. }
  19.  
  20. file ajouter(file f, element e)
  21. {
  22. f.tableau[f.head] = e;
  23. f.head++;
  24. return f;
  25. }
  26.  
  27. file retirer(file f)
  28. {
  29. f.tail++;
  30. return f;
  31. }
  32.  
  33. element premier(file f)
  34. {
  35. return f.tableau[f.head - 1];
  36. }
  37.  
  38. element dernier(file f)
  39. {
  40. return f.tableau[f.tail];
  41. }
  42.  
  43. bool file_vide(file f)
  44. {
  45. return (f.head == f.tail);
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement