#include <stdio.h>
#include <stdlib.h>
#define Status int
#define TRUE 1
#define FALSE 0
#define MAXSIZE
typedef int DataType;
typedef struct
{
DataType data[MAXSIZE];
int top;
}Stack;
//入栈,插入e为新的栈顶元素
Status Push(Stack *s, DataType e)
{
if (s->top == MAXSIZE - 1)
{
printf("栈已满\n");
return FALSE;
}
s->top++;
s->data[s->top] = e;
return TRUE;
}
//出栈,删除s的栈顶元素,并用e返回其值,返回TRUE,否则返回FALSE
Status Pop(Stack *s, DataType e)
{
if (s->top == -1)
{
printf("栈为空栈");
return FALSE;
}
s->data[s->top] = e;
s->top--;
return TRUE;
}
int main(int argc,char *argv[])
{
return 0;
}
#include <stdlib.h>
#define Status int
#define TRUE 1
#define FALSE 0
#define MAXSIZE
typedef int DataType;
typedef struct
{
DataType data[MAXSIZE];
int top;
}Stack;
//入栈,插入e为新的栈顶元素
Status Push(Stack *s, DataType e)
{
if (s->top == MAXSIZE - 1)
{
printf("栈已满\n");
return FALSE;
}
s->top++;
s->data[s->top] = e;
return TRUE;
}
//出栈,删除s的栈顶元素,并用e返回其值,返回TRUE,否则返回FALSE
Status Pop(Stack *s, DataType e)
{
if (s->top == -1)
{
printf("栈为空栈");
return FALSE;
}
s->data[s->top] = e;
s->top--;
return TRUE;
}
int main(int argc,char *argv[])
{
return 0;
}