-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueue.h
More file actions
36 lines (29 loc) · 687 Bytes
/
Copy pathqueue.h
File metadata and controls
36 lines (29 loc) · 687 Bytes
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
#ifndef QUEUE_H
#define QUEUE_H
#define QUEUE_EMPTY 1;
#define OUT_OF_MEMORY 2;
#define QUEUE_DOESNT_EXIST 3;
typedef int user_data;
typedef struct node
{
user_data data;
struct node *next;
}tNode;
typedef struct queue
{
int amount;
tNode *front, *rear;
}tQueue;
tQueue *createQueue(int* errorCode);
bool checkIfEmpty(tQueue *q, int* errorCode);
bool checkIfFull();
void enQueue(tQueue *q, user_data x, int* errorCode);
void deQueue(tQueue *q, int* errorCode);
int getData(tQueue *q, int* errorCode);
void freeQueue(tQueue *q);
#endif
/*
* Error code 1 - Queue is empty
* Error code 2 - Out of memory
* Error code 3 - Queue that you're trying to use was not created
*/