现有以下结构体说明和变量定义,如图所示,指针P,q,r分别指向一个链表中连续的三个结点。struct nod
现有以下结构体说明和变量定义,如图所示,指针P,q,r分别指向一个链表中连续的三个结点。
struct node { char data; struct node *next; } *p,*q,*r; 现要将q和r所指结点交换前后位置,同时要保持链表的连续,以下不能完成此操作的语句是()。
A.q->next=r->next;p->next=r;r->next=q;
B.p->next=r;q->next=r->next;r->next=q;
C.q->next=r->next;r->next=q;p->next=r;
D.r->next=q;P->next=r;q->next=r->next;