ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

La vida de juan


Enviado por   •  4 de Octubre de 2015  •  Apuntes  •  368 Palabras (2 Páginas)  •  119 Visitas

Página 1 de 2

#include<stdlib.h>

#include<stdio.h>

typedef struct nodo

{

int elemento;

struct nodo*enlace;

}TIPONODO;

typedef struct cola

{

TIPONODO *frente,*final,*nuevo;

}TIPOCOLA;

void CrearVacia(TIPOCOLA*q)

{

q->frente=q->final=NULL;

}

int EstaVacia(TIPOCOLA q)

{

return((q.frente==NULL)&&(q.final==NULL));

}

int EstaLlena(TIPOCOLA*q)

{

q->nuevo=(TIPONODO*)malloc(sizeof(TIPONODO));

return q->nuevo==NULL;

}

void Enqueue_(TIPOCOLA*q,int item)

{

q->nuevo->elemento=item;

q->nuevo->enlace=NULL;

if(EstaVacia(*q))

{

q->frente=q->final=q->nuevo;

}

else

{

q->final->enlace=q->nuevo;

q->final=q->nuevo;

}

}

void Enqueue(TIPOCOLA *q, int item)

{

if(EstaLlena (q))

{

printf("la cola esta llena");

}

else

{

Enqueue_(q,item);

}

}

void Dequeue_(TIPOCOLA *q)

{

TIPONODO *temp;

...

Descargar como (para miembros actualizados)  txt (2 Kb)   pdf (36 Kb)   docx (11 Kb)  
Leer 1 página más »
Disponible sólo en Clubensayos.com