-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstackandqueue.h
More file actions
39 lines (33 loc) · 750 Bytes
/
stackandqueue.h
File metadata and controls
39 lines (33 loc) · 750 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
37
38
39
//
// Created by Valdemar Landberg on 19-10-2019.
//
#ifndef THREADPROJEKT_STACKANDQUEUE_H
#define THREADPROJEKT_STACKANDQUEUE_H
typedef struct {
int * stack;
int top;
int size;
} Stack;
void stackInit (Stack * s, int size);
int sIsEmpty(Stack * s);
int sIsFull(Stack * s);
int sPeek(Stack * s);
int sPush(Stack * s, int element);
int sPop (Stack * s);
void sFree (Stack * s);
typedef struct {
int * queue;
int head;
int tail;
int size;
int max;
} Queue;
void queueInit (Queue * q, int size);
int qPeek (Queue * q);
int qIsEmpty (Queue * q);
int qIsFull(Queue * q);
int qSize(Queue * q);
int qInsert(Queue * q, int element);
int qRemove(Queue * q);
void qFree (Queue * q);
#endif //THREADPROJEKT_STACKANDQUEUE_H