输出流问题,求大神解释
struct node *creatlist(struct node *h){ struct node *p1,*p2; p1=p2=(struct node*)malloc(sizeof(struct node)); if(p1!=NULL) { scanf("%d\n",&p1->data); p1->next=NULL; } while(p1->data != -1) { if(h==NULL) h=p1; else p2->next=p1; p2=p1; p1=(struct node*)malloc(sizeof(struct node)); if(p1 != NULL) { scanf("%d\n",&p1->data); p1->next=NULL; } num++; } return(h);}
为什么在进行判断的时候我输入了-1,照理说是会退出的,但它不会,它需要我再任意输入一个数才会结束,这是为什么,求大神教
你是要参加c语言的乱码大赛。晕
页:
[1]