Guest User

Untitled

a guest
Jul 15th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. * Vinícius Marquez Candelária Professora: Jussara
  2.  
  3. DCC UFMG 2º Semestre 2009
  4.  
  5. ------------------------------------------------------------------------------------------
  6.  
  7. TAD FCFS */
  8.  
  9. //includes
  10.  
  11. #include <stdlib.h>
  12. #include <stdio.h>
  13. #include "FCFS.h"
  14.  
  15. //funções
  16.  
  17. void FFVazia(Fila *F)
  18. {
  19. F->Inicio = (Apontador) malloc(sizeof(Processo));
  20. F->Fim = F->Inicio;
  21. F->Inicio->Prox = NULL;
  22. }
  23.  
  24. int Vazia(Fila F)
  25. {
  26. return (F.Inicio == F.Fim);
  27. }
  28.  
  29. void IncluiProcesso(Processo *x,Fila *F)
  30. {
  31. F->Fim->Prox= x;
  32. F->Fim = F->Fim->Prox;
  33. }
  34.  
  35. void RetiraProcesso(Fila *F)
  36. {
  37. Apontador aux;
  38. if (Vazia(*F))
  39. {
  40. printf("ERRO: A fila está vazia.\n");
  41. return;
  42. }
  43. aux = F->Inicio;
  44. F->Inicio = F->Inicio->Prox;
  45. free(aux);
  46. }
Add Comment
Please, Sign In to add comment