请帮助下面的部分。当 n 从堆栈顶部移除且堆栈为空时,输出应为“-1 popped”。(我得到 0 atm)
void pop(void) {
struct node *temp;
int n;
if (top == NULL) {
printf("%d popped\n", top);
return;
}
n = top->item;
temp = top;
top = top->prev;
free(temp);
printf("%d popped\n", n);
return;
}