while(!p->next)是什么意思 和while(p1->next!=NULL)运行的结果不同
来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/07/06 16:59:26
while(!p->next)是什么意思 和while(p1->next!=NULL)运行的结果不同
STU *insert(STU *head){
int n;
STU *p1=NULL,*p2=NULL,*elem=NULL;
p1=head;
while(1){
scanf("%d",&n);
if(n>0){
elem=(STU *)malloc(sizeof(STU));
if(!elem) exit(0);
elem->num=n;
while(n>p1->num && p1->next!=NULL){
p2=p1;
p1=p1->next;
}
if(nnum){
if(head==p1){
elem->next=p1;
head=elem;
}
else{
p2->next=elem;
elem->next=p1;
}
}
else{
p1->next=elem;
elem->next=NULL;
}
}
else break;
}
return head;
}
STU *insert(STU *head){
int n;
STU *p1=NULL,*p2=NULL,*elem=NULL;
p1=head;
while(1){
scanf("%d",&n);
if(n>0){
elem=(STU *)malloc(sizeof(STU));
if(!elem) exit(0);
elem->num=n;
while(n>p1->num && p1->next!=NULL){
p2=p1;
p1=p1->next;
}
if(nnum){
if(head==p1){
elem->next=p1;
head=elem;
}
else{
p2->next=elem;
elem->next=p1;
}
}
else{
p1->next=elem;
elem->next=NULL;
}
}
else break;
}
return head;
}
![while(!p->next)是什么意思 和while(p1->next!=NULL)运行的结果不同](/uploads/image/z/1041196-4-6.jpg?t=while%28%21p-%3Enext%29%E6%98%AF%E4%BB%80%E4%B9%88%E6%84%8F%E6%80%9D+%E5%92%8Cwhile%28p1-%3Enext%21%3DNULL%29%E8%BF%90%E8%A1%8C%E7%9A%84%E7%BB%93%E6%9E%9C%E4%B8%8D%E5%90%8C)
while(!p->next)相当于 while(p->next == 0)
当然和 while(p1->next!=NULL) 不同
当然和 while(p1->next!=NULL) 不同
while(!p->next)是什么意思 和while(p1->next!=NULL)运行的结果不同
while(p1) while(p1->next) { { p1=p1->next; p1=p1->next; } }
C++while循环中p->next!=NULL与p!=NULL的适用范围分别是什么?如题
while(p->next)p=p->next;
数据结构问题,while条件里面纠结p-next!=NULL还是p!=NULL的问题.如何判断
关于你编写的求一元多项式的和 if(!pa&&pb) while(c-->next!=Null){ c=c-->next
While(p->next)求解释
p1=p2;p1->next!=NULL;p1=p1->next
在数据结构中 LinkList *p=L->next;While(p!
=NULL与p->next!=NULL区别?
单链表逆位序输值L->next=NuLL,p->next=L->next,L->next=p什么意思
for(p = head; p->next = NULL; p = p->next);p->next =