-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStack.h
More file actions
54 lines (48 loc) · 894 Bytes
/
Copy pathStack.h
File metadata and controls
54 lines (48 loc) · 894 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Stack.h
*
* Created on: May 19, 2016
* Author: Moawiya
*/
#ifndef STACK_H_
#define STACK_H_
#include "Memory/MemoryChecker.h"
#include <stdio.h>
#include <stdlib.h>
typedef struct _Stack_t *Stack;
typedef enum _ret_t {
Success, Failure, NullArgument, MemoryError, NoElements
} ReturnVal;
typedef struct _StackElement_t *StackElement;
typedef void* StackData;
typedef StackData (*copyStackData)(StackData);
typedef void (*freeStackData)(StackData);
/*
*
*/
Stack createStack(copyStackData, freeStackData);
/*
*
*/
void destroyStack(Stack);
/*
* push element to the stack O(1)
*/
ReturnVal push(StackData, Stack);
/*
* pop element from the top of stack O(1)
*/
ReturnVal pop(Stack);
/*
* return the value of the top element O(1)
*/
ReturnVal top(Stack, StackData*);
/*
*
*/
unsigned int stackSize(Stack);
/*
*
*/
void printStack(Stack);
#endif /* STACK_H_ */