数据结构 栈的应用之判断回文数

问题遇到的现象和发生背景

代码问题

问题相关代码,请勿粘贴截图

#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#define MAXSIZE 50
#define SIZE 100

typedef char datatype;
typedef struct{
datatype a[MAXSIZE];
int top;
}sequence_stack;

//
/* 函数功能:栈(顺序存储)初始化 /
/
函数参数:指向sequence_stack型变量的指针变量st /
/
函数返回值:空 */
/
/
void init(sequence_stack *st)
{
st->top=0;
}

//
/* 函数功能:判断栈(顺序存储)是否为空 /
/
函数参数:sequence_stack型变量st /
/
函数返回值:int类型。1表示空,0表示非空 */
/
/
int empty(sequence_stack st)
{
return(st.top? 0:1);
}

//
/* 函数功能:读栈顶(顺序存储)结点值 /
/
函数参数:sequence_stack型变量st /
/
函数返回值:datatype类型。返回栈顶结点值 */
/
/
datatype read(sequence_stack st)
{
if (empty(st))
{printf("\n栈是空的!");exit(1);}
else
return st.a[st.top-1];
}

//
/* 函数功能:栈(顺序存储)的插入(进栈)操作 /
/
函数参数:指向sequence_stack型变量的指针变量st /
/
datatype型变量x /
/
函数返回值:空 */
/
/
void push(sequence_stack *st,datatype x)
{
if(st->top==MAXSIZE)
{printf("\nThe sequence stack is full!");exit(1);}
st->a[st->top]=x;
st->top++;
}

//
/* 函数功能:栈(顺序存储)的删除(出栈)操作 /
/
函数参数:指向sequence_stack型变量的指针变量st /
/
函数返回值:空 */
/
/
datatype pop(sequence_stack *st)
{
datatype x;
if(st->top==0)
{printf("\nThe sequence stack is empty!");exit(1);}
x=st->a[st->top-1];
st->top--;
return x;
}

//
/
函数功能:判断一个字符串是不是回文串操作 /
/
函数参数:已知字符串 /
/
函数返回值:int类型,返回一个整数用于判断是不是回文串
/
/
**/
int Is_Pstring(sequence_stack *st,char str[])
//待补充
int main()
{
char str[SIZE];
sequence_stack s;
init(&s);
scanf("%s",str);
if(Is_Pstring(&s,str))
printf("是回文串");
else
printf("不是回文串");
}

运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果

待补充的地方应该填什么呀

供参考:

#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#define MAXSIZE 50
#define SIZE 100

typedef char datatype;
typedef struct {
    datatype a[MAXSIZE];
    int top;
}sequence_stack;

//
// 函数功能:栈(顺序存储)初始化 /
//函数参数:指向sequence_stack型变量的指针变量st/
//函数返回值:空 */
//
void init(sequence_stack* st)
{
    st->top = 0;
}

//
// 函数功能:判断栈(顺序存储)是否为空 /
//函数参数:sequence_stack型变量st/
//函数返回值:int类型。1表示空,0表示非空 */
//
int empty(sequence_stack st)
{
    return(st.top ? 0 : 1);
}

//
// 函数功能:读栈顶(顺序存储)结点值 /
//函数参数:sequence_stack型变量st/
//函数返回值:datatype类型。返回栈顶结点值 */
//
datatype read(sequence_stack st)
{
    if (empty(st))
    {
        printf("\n栈是空的!");
        exit(1);
    }
    else
        return st.a[st.top - 1];
}

//
// 函数功能:栈(顺序存储)的插入(进栈)操作 /
//函数参数:指向sequence_stack型变量的指针变量st/
//datatype型变量x/
//函数返回值:空 */
//
void push(sequence_stack* st, datatype x)
{
    if (st->top == MAXSIZE)
    {
        printf("\nThe sequence stack is full!");
        exit(1);
    }
    st->a[st->top] = x;
    st->top++;
}

//
// 函数功能:栈(顺序存储)的删除(出栈)操作 /
//函数参数:指向sequence_stack型变量的指针变量st/
//函数返回值:空 */
//
datatype pop(sequence_stack* st)
{
    datatype x;
    if (st->top == 0)
    {
        printf("\nThe sequence stack is empty!");
        exit(1);
    }
    x = st->a[st->top - 1];
    st->top--;
    return x;
}

//
//函数功能:判断一个字符串是不是回文串操作/
//函数参数:已知字符串/
//函数返回值:int类型,返回一个整数用于判断是不是回文串 /
//待补充
int Is_Pstring(sequence_stack* st, char str[])
{
    char c;
    int i, len = strlen(str);
    for (i = 0; i < len; i++)
        push(st, str[i]);
    i = 0;
    while (!empty(*st)) {
        c = pop(st);
        if (c != str[i])
            return 0;
        i++;
    }
    if (empty(*st))
        return 1;
}

int main()
{
    char str[SIZE];
    sequence_stack s;
    init(&s);
    scanf("%s", str);
    if (Is_Pstring(&s, str))
        printf("是回文串");
    else
        printf("不是回文串");
}