- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayBaseStack.c
More file actions
Latest commit
29 lines (24 loc) · 456 Bytes
/
Copy pathArrayBaseStack.c
File metadata and controls
29 lines (24 loc) · 456 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
#include"ArrayBaseStack.h"
voidStackInit(Stack*pstack)
{
pstack->topIndex=-1;
}
intSIsEmpty(Stack*pstack)
{
if(pstack->topIndex==-1)
return TRUE;
return FALSE;
}
voidSPush(Stack*pstack, Datadata)
{
(pstack->topIndex)++;
pstack->stackArr[pstack->topIndex] =data;
}
DataSPop(Stack*pstack)
{
returnpstack->stackArr[(pstack->topIndex)--];
}
DataSPeek(Stack*pstack)
{
returnpstack->stackArr[pstack->topIndex];
}