#include <stdio.h>
#define MAXSIZE 100
typedef struct SqStack
{
void* data[MAXSIZE];
int top;
}SqStack;
void InitStack(SqStack* );
int StackEmpty(SqStack* );
int StackLength(SqStack* );
void ClearStack(SqStack* );
void GetTop(SqStack*, void** );
void PushStack(SqStack*, void* );
void PopStack(SqStack*, void**);
#include <stdio.h>
#include <string.h>
#include "sqstack.c"
void InitStack(SqStack* S)
{
S->top = -1;
memset(S->data, 0, sizeof(S->data));
}
int EmptyStack(SqStack* S)
{
if(S->top == -1)
return 1;
else
return 0;
}
void ClearStack(SqStack* S)
{
S->top = -1;
}
void GetTop(SqStack* S, void** e)
{
if(S->top = -1) return;
*e = S->data[S->top];
}
void PopStack(SqStack* S, void** e)
{
if(S->top == -1) return;
*e = S->data[S->top];
S->top--;
}
void PushStack(SqStack* S, void* e)
{
if(S->top == MAXSIZE - 1)
return;
S->top++;
s->data[S->top] = e;
}
int StackLength(SqStack* S)
{
return S->top+1;
}