一个奇怪的现象
void paixu(LinkList *L){
LinkList *t,*p=L->next,*r;
if(p!=NULL)
{
/*p=L->next;
p=p->next;
L->next->next=NULL;//将表变为只含1个元素,p为末尾*/
t=p->next;
p->next=NULL;
p=t;
while(p!=NULL)
{t=p->next;
r=L;
while(r->next!=NULL&&r->next->data<p->data)//

r=r->next;
p->next=r->next;
r->next=p;
p=t;
}
}
}
这是我在编写数据结构中将单链表L的元素按递增排序。
但是在上述程序中不小心定义为:while(r->next->data<p->data&&r->next!=NULL) 运行时 出现了0x0000000不能read
之后改为while(r->next!=NULL&&r->next->data<p->data)则结果正确,这是为什么?只是将while的限定&&两边交换了


