-
Notifications
You must be signed in to change notification settings - Fork 1
/
queue.h
43 lines (33 loc) · 1.15 KB
/
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
40
41
42
43
#ifndef QUEUE_H
#define QUEUE_H
//QUEUE OF DOUBLES MODULE
//Queue object
typedef struct Queue Queue;
//Node of queue
typedef struct Node Node;
/************************************************
*create and initializing queue *
*add function: enter p1+p2 into p1 *
*sub function: enter p1-p2 into p1 *
*div function: return pointer to p1/p2 *
************************************************/
extern Queue* createQueue(void (*add)(void*, void*),
void (*sub)(void*, void*),
void* (*div)(void*, void*));
//delete all queue objects
extern void destroyQueue(Queue*);
//add value to the end of queue
extern int addQueueNode(Queue*, void*);
/************************************************
return data of first Node and remove the node. *
***DONT USE FOR EMPTY QUEUE (length==0)*** *
************************************************/
extern void* popQueue(Queue*);
//return list length
extern int getQueueLength(Queue*);
/************************************************
return data of first Node *
***DONT USE FOR EMPTY QUEUE (length==0)*** *
************************************************/
extern void* topQueue(Queue*);
#endif