#include "stdio.h"
#include "stdlib.h"
#define N 100
#define TRUE 1
#define FALSE 0
typedef struct queue{
int data[N];
int front, rear;
}*pqueue,lqueue;
//置空队列
int empty(pqueue p)
{
p->front = p->rear = 0;
printf("队列已经置空!\n");
return TRUE;
}
//判断队列是否为空
int isempty(pqueue p)
{
if (p->front == p->rear)
{
printf("队列为空!\n");
return FALSE;
}
else
#include "stdlib.h"
#define N 100
#define TRUE 1
#define FALSE 0
typedef struct queue{
int data[N];
int front, rear;
}*pqueue,lqueue;
//置空队列
int empty(pqueue p)
{
p->front = p->rear = 0;
printf("队列已经置空!\n");
return TRUE;
}
//判断队列是否为空
int isempty(pqueue p)
{
if (p->front == p->rear)
{
printf("队列为空!\n");
return FALSE;
}
else

该博客介绍如何使用C语言实现顺序队列,包括初始化队列、判断队列是否为空、入队、出队、遍历队列以及计算队列长度的函数实现,并提供了一个主函数示例来演示这些操作。
最低0.47元/天 解锁文章
1万+





