#include <stdio.h>
#include <stdlib.h>
#include "fila.h"
//typedef int elemento;
int vazio(struct nodo *campo)
{
if ( campo == NULL )
return 1;
else
return 0;
}
int vazio1()
{
if ( inicio == NULL )
return 1;
else
return 0;
}
void enqueue(int x)
{
aux=(struct nodo *) malloc(sizeof(aux));
aux->elem=x;
aux->prox=NULL;
if (vazio(inicio)) inicio=fim=aux;
else {
fim->prox=aux;
fim=fim->prox;
}
printf("Inserido com sucesso!");
getchar();
}
void dequeue(void)
{
if (vazio(inicio)) {
printf("Fila vazia!\n");
getchar();
} else {
aux=inicio;
inicio=inicio->prox;
free(aux);
printf("Removido com sucesso!\n");
getchar();
}
}
void listar(void)
{
if (!vazio(inicio)) {
for (aux=inicio;!vazio(aux->prox);aux=aux->prox)
printf("%d\n",aux->elem);
printf("%d\n",aux->elem);
} else
printf("Fila Vazia!");
getchar();
}
int recupera(void)
{
return inicio->elem;
}