-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstack.h
41 lines (31 loc) · 850 Bytes
/
stack.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
/*
* stack.h
*
* Created on: 30 áéåì 2019
* Author: shake
*/
#ifndef STACK_H_
#define STACK_H_
#include "Cell.h"
typedef struct {
int top;
int capacity;
Cell* array;
}Stack;
/*generate an empty stack*/
Stack* createStack(int capacity);
/*check whether the stack is empty*/
int isEmpty(Stack* stack);
/*check whether the stack is full*/
int isFull(Stack* stack);
/*add item to the top of the stack*/
void push(Stack* stack, Cell item);
/*remove item from the top of the stack*/
Cell* pop(Stack* stack);
/*return the item from the top of the stack*/
Cell* peek(Stack* stack);
/*free all memories allocated to the stack*/
void freeStack(Stack* stack);
/*concatenate another stack to the top of the current stack*/
void concat(Stack* stack, Stack* another);
#endif /* STACK_H_ */