数据结构总是报错求解
void InitQueue(Queue *s)
{
s->front=(ElemType *)malloc((SIZE)*sizeof(ElemType));
s->front=s->rear;
s->sizeQueue=SIZE;
}
void InQueue(Queue *s,int e)
{
if (s->rear-s->front==s->sizeQueue) exit(0);
*s->rear=e; //////到这报错;//Program received signal SIGSEGV, Segmentation fauit
s->rear++;
}
内存错误,检查空指针。 链队列没有给s->rear的下一个节点分配空间啊,我觉得初始队列中s->rear还没初始化怎么能赋值给s->front呢,感觉有问题
页:
[1]