1、已知带头结点的链栈top, 则该链栈不空时, 出栈操作的语句是( )
A: top->next=top->next->next; *x=top->next->data;
B: top->next=top->next->next; *x=top->next->data;
C: *x=top ->data;p=top;top =p->next;free(p);
D: *x=top ->data;p=top;top =p->next;free(p);
A: top->next=top->next->next; *x=top->next->data;
B: top->next=top->next->next; *x=top->next->data;
C: *x=top ->data;p=top;top =p->next;free(p);
D: *x=top ->data;p=top;top =p->next;free(p);
举一反三
- 已知带头结点的链栈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);
- 已知带头结点的链栈top,则该链栈不空时,出栈操作的语句是____ A: top->next=top->next->next;<br/>*x=top->next->data; B: *x=top->next->data;<br/>p=top->next; top->next=p->next; free(p); C: *x=top->next->data;<br/>top->next=top->next->next; free(top->next); D: *x=top<br/>->data; p=top; top =p->next; free(p);
- 假定一个链栈的栈顶指针用top表示,当p指向的结点进栈时,执行的操作为( )。 A: p->next=top; top=top->next; B: top=p; p->next=top; C: p->next=top->next; top->next=p ; D: p->next=top; top=p;
- 一个链栈的栈顶指针是top,则执行出栈操作时(栈非空),用x保存被删除结点,则执行 A: x=top;top=top->next; B: B. x=top->data; C: top=top->next;x=top->data; D: x=top->data;top=top->next;
- 已知带头结点的链栈top, 则该链栈为空的条件是( ) A: top==NULL B: top->next= =NULL C: top->next->next= =NULL D: top->next= =top