#include "queue2.h" #include #include struct queue { void *element; queue next; }; queue queue_create(void) { return NULL; } queue queue_enq(queue q, void *element) { if(q == NULL) { queue temp = malloc(sizeof(struct queue)); temp -> element = element; temp -> next = NULL; return temp; } else { queue temp = malloc(sizeof(struct queue)); temp -> element = q -> element; temp -> next = queue_enq(q -> next, element); return temp; } } int queue_empty(queue q) { return q == NULL; } void * queue_front(queue q) { assert(!queue_empty(q)); return q -> element; } queue queue_deq(queue q) { assert(!queue_empty(q)); return q -> next; }