编辑代码

#include <stdio.h>
#include "malloc.h"
#define datatype char 
#define MAXSIZE 100
typedef struct 
{
    datatype data[MAXSIZE];
    int top;
}SEQSTACK;
SEQSTACK *s;
 
void Init_Stack(SEQSTACK *s);
{
    s->top=-1;
}
int Stack_Empty(SEQSTACK *s)
{
    if(s->top==MAXSIZE-1)
    printf("Stack full\n");
    else 
    {
        s->top++;
        s->data[s->top]=x;
    }
}
datatype Gettop_Stack(SEQSTACK *s)
{
    datatype x;
    if(Stack_Empty (s))
    {
        printf("Stack empty.\n");
        x=Null;
    }
    else
        x=s->data[s->top];
        return x;

 }