-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharraystack.h
More file actions
47 lines (35 loc) · 1.02 KB
/
Copy patharraystack.h
File metadata and controls
47 lines (35 loc) · 1.02 KB
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
#ifndef _ARRAYSTACK_
#define _ARRAYSTACK_
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
// ArrayList's Element
typedef struct ArrayStackNodeType
{
int data; // Element's data
} ArrayStackNode;
// ArrayList
typedef struct ArrayStackType
{
int maxElementCount; // Element's max index
int currentElementCount; // Element's current index
ArrayStackNode *pElement; // array to store data
} ArrayStack;
// create arraystack
ArrayStack* createArrayStack(int maxElementCount);
// delete arraystack
void deleteArrayStack(ArrayStack* pStack);
// check the array whether it is full
int isArrayStackFull(ArrayStack* pStack);
// push element to arraystack
int pushAS(ArrayStack* pStack, ArrayStackNode element);
// pop element from arraystack
ArrayStackNode popAS(ArrayStack* pStack);
// return the latest element
ArrayStackNode* peekAS(ArrayStack* pStack);
// set zero all element
void clearArrayStack(ArrayStack* pStack);
// check ArrayStack is Empty
int isArrayStackEmpty(ArrayStack* pStack);
#endif