C语言实现链式队列结构

本文介绍如何利用单链表实现链式队列,详细阐述了单链表的实现过程,并提及该结构在二叉树层序遍历中的应用。已通过测试验证。
摘要由CSDN通过智能技术生成

使用单链表就行了。为了实现链式队列, 我先去实现单链表。single_linked_list.h 是我实现的单链表的头文件, 查看我的单链表实现文章,了解细节。
这个模块我用在了二叉树上的层序遍历.
下面的函数已经测试过了

/********************************************************************************
* Copyright(c) 2019-20xx
* All right resered.
*
* @file     chain_queue.c
* @author   hongsmallgod
* @version  V1.0.1
* @data     2019-9-10 10:31:28
* @brief    链式队列源文件
********************************************************************************/
#include <stdlib.h>
#include "chain_queue.h"
static int get_queue_elem_num(queue *);
static int head(queue *, element *);
static int tail(queue *, element *);
static int enqueue(queue *, element);
static int dequeue(queue *, element *);
static int full(queue *);
static int empty(queue *);

/*
** function  : create_queue
** author	 : hongsmallgod
** brief     : 创建一个队列
** argument  : void
** return 	 : @q: 队列指针
*/
queue *create_queue(void)
{
   
    queue *q= (queue*)malloc(
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值