#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct {
char *ruta;
char *archivo;
} datos;
struct cola {
struct nodo *ini;
struct nodo *fin;
};
struct nodo {
datos valores;
struct nodo *sig;
};
struct cola *colaVacia(struct cola *c);
int esVacia(struct cola *c);
struct cola *push(struct cola *c,char *r, char *a);
struct cola pop(struct cola *c);
struct nodo *cabeza(struct cola *c);
int main(){
struct cola
*c
=(struct cola
*) malloc(sizeof(struct cola
)); struct nodo *q;
c=colaVacia(c);
char *r;
char *a;
char *r1;
char *a1;
int i;
r
=(char *) malloc(4 * sizeof(char)); a
=(char *) malloc(4 * sizeof(char)); r1
=(char *) malloc(4 * sizeof(char)); a1
=(char *) malloc(4 * sizeof(char));
for(i=0;i<3;i++){
if(i==0){
} else if(i==1){
} else {
}
c=push(c,r,a);
printf("Ini: %sn",c
->ini
->valores.
ruta); printf("Fin: %sn",c
->fin
->valores.
ruta); }
while(cabeza(c)!=NULL){
printf("%s %sn",c
->ini
->valores.
ruta,c
->ini
->valores.
archivo); *c=pop(c);
}
}
struct cola *colaVacia(struct cola *c) {
c->ini==NULL;
c->fin==NULL;
return c;
}
int esVacia(struct cola *c) {
return(c->ini==NULL);
}
struct cola *push(struct cola *c,char *r, char *a) {
struct nodo
*nuevo
=(struct nodo
*)malloc(sizeof(struct nodo
));
nuevo->valores.ruta=r;
nuevo->valores.archivo=a;
nuevo->sig=NULL;
if(esVacia(c)) {
c
->ini
=(struct nodo
*) malloc(sizeof(struct nodo
)); c->ini=nuevo;
c->fin=nuevo;
} else {
c
->fin
->sig
=(struct nodo
*) malloc(sizeof(struct nodo
)); c->fin->sig=nuevo;
c->fin=nuevo;
}
return(c);
}
struct cola pop(struct cola *c) {
c->ini=c->ini->sig;
if(c->ini==NULL) {
c=colaVacia(c);
}
return(*c);
}
struct nodo *cabeza(struct cola *c) {
return(c->ini);
}