
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Spring 2006 Programming Project #1 โ Queues Due Date: 01-25- Write a C module to implement queues with a circular linked list given the following interface: // type for a queue object typedef struct queue *qtype; // returns a new queue object qtype Qinit(); // add an item to the queue int Qadd(qtype q, void *data); // remove an item from the queue int Qremove(qtype q, void *data); // return the head item of the queue void *Qshow(qtype q); // move the head item to the tail of the queue // and return the new head item void *Qnext(qtype q); // free the given queue and all memory it is using int Qfree(qtype q); Functions returning a void * of qtype should return NULL on error; while functions returning int should return -1 on error and zero on success. In the case of an error the global variable errno should be set to the error code as shown below: EQNOMEM // not enough memory to complete the operation EQBADQ // argument is not a queue EQNODATA // no data is available EQUNKNOWN // any other error You must turn in five files: error.h : contains #defines for error codes and extern definition for errono queue.h : contains the interface definition given above queue.c : contains the implementation of the queue package qtest.c: test harness that tests the queue package queue.doc (pdf) : contains project report and documentation Makefile : properly compile and link your project