• 2022-05-29
    函数del的功能是删除以head为首链表中学号为num的节点,请在______处填写适当内容,完成函数。 struct student{ int num; int score; struct student *next; }; struct student *del(struct student *head ,int num){ struct student *sp1,*sp2; if(head==NULL) return head; sp1=head; while(num!=_________){ sp2=sp1; sp1=sp1->next; } if(num==sp1->num){ if(sp1==head){ ­___________=sp1->next; }else if(sp1->next==NULL){ sp2->next=________; }else{ sp2->next=sp1->next; } } return head; }
    A: sp1->num head NULL
    B: sp2->num sp1 NULL
    C: sp2->num sp2 sp1
    D: sp1->num head sp1
  • 举一反三