数据结构之单链表
#include "stdio.h"
#define MAX 100 //定义最大
struct stack //栈
{
long int number[MAX];
int top; //记录栈顶
}
struct queue //队列
{
long int number[MAX];
int front; //队头
int rear; //队尾
}
void buy(stack *p,queue *p1) //转换函数
{
p1->front=0; //将队列头设置为0;
p1->rear=p->top; //根据栈的大小设置队列尾
int i;
for(i=0;i<top;i++)
p1->number[i]=p->number[i]; //依次赋值
}