node *head,*p,*rear;rear=head->next;head 没有申请内存,所以 head->next 是错误的,属于野指针。head = (node*)malloc(sizeof(node));其他涉及到node 的地方都要申请内存。