⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pop.c

📁 建立学生记录
💻 C
字号:
#include<stdio.h>
struct node
{ int data;
struct node * next;
};
void pushs(struct node **top,int x)
{struct node *p;
p=(struct node *)malloc(4);
p->data=x;
p->next=(*top);
(*top)=p;
}
int pops(struct node **top)
{struct node *p;
int x;
if (*top==NULL)
{printf("The stack is underflow");
return(NULL);
}
else x=(*top)->data;
p=(*top);
(*top)=(*top)->next;
free(p);
return(x);
}
main()
{ int i,x;
struct node * h;
printf("please input an int number:\n");
scanf("%d",&i);
while(i!=-1)
{ pushs(&h,i);
printf("please input again:\n");
scanf("%d",&i);
}
x=pops(&h);
printf("%d",x);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -