我插入元件在队列中,但无限循环运行 // x被被输入无限循环
void enqueue(int x)
{
queue *ptr;
ptr=(queue*)malloc(sizeof(queue));
ptr->info=x;
if(front==NULL&&rear==NULL)
{
front=rear=ptr;
ptr->next=NULL;
}
else
{
rear->next=ptr;
rear=ptr;
}
}
//显示功能打印元件的元件
void show()
{
queue *ptr=front;
while(ptr!=NULL)
{
printf("%d\n",ptr->info);
ptr=ptr->next;
}
}
标准警告:请[不要转换](http://stackoverflow.com/q/605845/2173917)''malloc()'和家族在'C'的返回值。 – 2015-04-06 11:45:47
演员之间有冲突,不要在上述讨论中施展冲突,所以要遵循哪一个 – Dumb 2015-04-06 11:57:25