设指针变量p指向非空单链表中的结点,next是结点的指针域,现要删除p所指结点的所有后继结点,则下列语句中正确的是
A
while(p!NULL){q=p;p=p- >next;free(q);}
B
while(p!NULL){q=p->next=p->next->next;free(q);}
C
while(p->next!=NULL ){q=p->next;p=p->next;free(q);}
D
while(p->next!=NULL){q=p->next;p- >next=p->next- >next;free(q);}