已知带头结点的链栈top,则该链栈不空时,出栈操作的语句是()

10 查阅

已知带头结点的链栈top,则该链栈不空时,出栈操作的语句是()

A.top->next=top->next->next;*x=top->next->data;

B.*x=top->next->data;top->next=top->next->next;free(top->next);

C.*x=top->data;p=top;top=p->next;free(p);

D.*x=top->next->data;p=top->next;top->next=p->next;free(p);

参考答案:

答案:*x=top->next->data;p=top->next;top->next=p->next;free(p);