-->
当前位置:首页 > 题库

程序填空题:入链队列

Luz5年前 (2021-05-10)题库2892
本题目要求使用函数In_LQueue(LQueue *q , datatype x)将数据x入链队列q中。

```c++
#include
#include
typedef int datatype;
typedef struct node
{
datatype data;
struct node *next;
}QNode;

typedef struct
{
QNode *front, *rear;
}LQueue;

void In_LQueue(LQueue *q , datatype x)
{
QNode *p;
p=(QNode * )malloc(sizeof(QNode));
p->data=x;
p->next=NULL;
@@[q->rear->next=p](3);
@@[q->rear=p](3);
}

```






答案:
第1空:q->rear->next=p

第2空:q->rear=p