-
Notifications
You must be signed in to change notification settings - Fork 0
/
queue.h
40 lines (32 loc) · 908 Bytes
/
queue.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef QUEUE_H
#define QUEUE_H
#include "llist.h"
typedef struct _queue {
llist *st;
} queue;
/* create_queue
* purpose: create and initialize queue with no items in it
* inputs: none
* output: pointer to the newly created and initialized queue
*/
queue* create_queue();
/* enqueue
* purpose: insert an item into the queue
* inputs: queue* the queue on which to enqueue the data
* void* the item to enqueue on the queue
* return value: none
*/
void enqueue(queue*, void*);
/* dequeue
* purpose: return the item that was enqueue least recently
* inputs: queue from which to dequeue the item
* output: item that used to be the top of the queue
*/
void* dequeue(queue*);
/* queue_is_empty
* purpose: pseudoboolean function that returns whether or not a queue is empty
* inputs: queue
* output: pseudoboolean value - 0 for false, nonzero for true
*/
int queue_is_empty(queue*);
#endif