#include <stdio.h>
#include <stdlib.h>
#define STACKSIZE 10 //栈存储空间的初始分配量
#define STACKINCREMENT 5 //栈分配空间的分配增量
#define MAXQSIZE 100 //队列存储空间的初始分配量
typedef struct
{
char *base;
char *top;
int stacksize; //栈可用的最大容量
} SqStack;
typedef struct
{
char *base;
int front; //头指针,若队列不为空,指向队列头元素
int rear; //尾指针,若队列不为空,指向队尾元素的下一个位置
} SqQueue;
int main()
{
SqStack S;
SqQueue Q;
int ending;
char e, h, c, e1, e2;
int InitStack(SqStack * S); //栈的初始化
int Push(SqStack * S, char e); //入栈
char Pop(SqStack * S); //出栈
// void PrintStack(SqStack * S); //遍历栈
int InitQueue(SqQueue * Q); //队列初始化
int EnQueue(SqQueue * Q, char h); //入队
char DeQueue(SqQueue * Q); //出队
// int PrintQueue(SqQueue * Q); //遍历队列
InitStack(&S);
InitQueue(&Q);
printf("请输入字符序列,以@结束:");
while ((c = getchar()) != '@')
{
Push(&S, c);
EnQueue(&Q, c);
}
/*p
Palindrome字符回文 (C语言)
于 2022-04-10 18:34:59 首次发布