struct student* del(struct student* head, long num){struct student *p1, *p2;if(head == NULL){printf("\nlist null\n");goto end;}p1 = head;while(num != p1->num && p1->next != NULL)//p1指向的不是所要的结点,并且后还有结点。{p2 = p1;p1 = p1->next;//p1向后移一个结点。}if(num == p1->num){if(p1 == head){head = p1->next;}else{p2->next = p1->next;}printf("delete:%ld\n",num);n = n-1;}else{printf("%ld not been found!\n", num);//找不到该结点。}end://这个end是什么意思?为什么写在这里?return head;}
添加回答
举报
0/150
提交
取消