链表实现队列
摘要:
插入队列时,注意判断队列是否为空出队列时,注意判断:1 队列是否为空 2 是否是最后一个元素出队列 3 正常出队列#include<stdio.h>#include<stdlib.h>typedef struct list{int data;struct list*next;}List;typedef struct queue{List*front;List*rear;}Queue;void init_queue(Queue*q){q->front=q->rear=NULL;}void inqueue(Queue *q,int data){List*newn 阅读全文
posted @ 2012-04-21 23:23 ITfeng 阅读(238) 评论(0) 推荐(0) 编辑