為什么一執(zhí)行就停止運行啊
#include <stdio.h>
struct date{int price;
int attack;
struct date *next;//next 用來存放下一個結(jié)點的地址
};
int main()
{
?struct date a,b,c,*head;
??? a.price=1;
?a.attack=100;
?b.price=2;
?b.attack=200;
?c.price=3;
?c.attack=300;
??? head=&a;
?a.next=&b;
?b.next=&c;
??? c.next=NULL;
?struct date *p;
?p=head;
?while(p=!NULL)
?{
??printf("%d,%d\n",p->price,p->attack);
??p=p->next;
?}
?return 0;
}
2018-05-29
一般停止運行代表程序存在非讀取的錯誤,使得程序無法執(zhí)行
2017-10-17
?while(p=!NULL)應(yīng)修改為:while(p != NULL)