题目内容:
现有以下结构体说明和变量定义,如图所示,指针P、q、r分别指定一个链表中连续的3个结点。struct node
{har data;
struct node*next;)*p,*q,*r;
现要将q和r所指结点交换前后位嚣,同时要保持链表的结构,下列不能完成此操作的语句是( )。 A.q->next=r->next;p->next=r;r->next=q;
B.q->next=r;q-->next=r->next;r->next=q;
C.q->next=r->next;r->next=q;p->next=r;
D.q->next=q;p->next=r;q->next=r->next;
参考答案:
答案解析: