当前位置: 首页 > news >正文

深圳做外贸网站公司哪家好/指数基金排名前十名

深圳做外贸网站公司哪家好,指数基金排名前十名,广告字制作哪家好,免费电视剧大全网站栈作为一种简单但常用的数据结构&#xff0c;要想完全正确的实现还是需要经过一番考虑的。《剑指offer》这本书一再强调代码的鲁棒性。 下面是一个栈的简单c语言实现&#xff0c;作为一个学习过程记录如下。 #include <stdio.h> #include <stdlib.h>int gError 0…

栈作为一种简单但常用的数据结构,要想完全正确的实现还是需要经过一番考虑的。《剑指offer》这本书一再强调代码的鲁棒性。

下面是一个栈的简单c语言实现,作为一个学习过程记录如下。

#include <stdio.h>
#include <stdlib.h>int gError = 0; //用于栈为空时,仍弹栈的标记
typedef struct Node {
int data;
struct Node* next;
} Node ;
int length(Node*);
void push(Node** stack,const int a)
{if(*stack==NULL){*stack = (Node*)malloc(sizeof(Node));(*stack)->data = a;(*stack)->next = NULL;} else {Node* p = *stack;int len = length(p);for(int i=0;i<len-1;i++){p = p->next;}p->next = (Node*)malloc(sizeof(Node));p->next->data = a;p->next->next = NULL;}
}
int length(Node* head)
{Node* p = head;int count = 0;while(p!=NULL){p = p->next;count++;}return count;
}
int pop(Node** head)
{if(*head==NULL){fprintf(stdout,"null stack\n");gError = 1;return -1;}Node* p = *head;int len = length(p);int tmp = 0;Node* prev = NULL;if(len==1){tmp = p->data;free(p);*head = NULL;} else {for(int i=0;i<len-1;i++){prev = p;p = p->next;}prev->next = NULL;tmp = p->data;free(p);}return tmp;
}
void  print(Node* head)
{Node* p = head;while(p!=NULL){fprintf(stdout,"%3d",p->data);p = p->next;}
}int main(void)
{Node* head = NULL;push(&head,13);push(&head,14);push(&head,15);push(&head,16);print(head);printf("\n");printf("top is : %d\n",pop(&head));printf("top is : %d\n",pop(&head));printf("top is : %d\n",pop(&head));printf("top is : %d\n",pop(&head));return 0;
}

http://www.lbrq.cn/news/943831.html

相关文章:

  • wordpress二级菜单调用/郑州seo外包顾问热狗
  • 做图兼职网站有哪些/短视频营销
  • 表白网站在线制作软件/海外网站推广的公司
  • 贵州省教育厅办公室关于开展2014年学校门户网站建设评估的通知/免费网站建设seo
  • 知知网站推荐/青岛网站建设制作
  • 为什么进不了中国建设银行网站/推广任务接单平台
  • 建设企业网站官网u盾登录/网站制作
  • 靖安建设局网站/网络建设推广
  • 常州网站建设 最易/百度推广开户代理
  • 淘宝客服推销做网站的技巧/深圳知名网络优化公司
  • vs做网站头部的代码/网店推广营销方案
  • 武汉市做网站/怎么免费建公司网站
  • 云服务器怎么样做网站/百度搜索风云榜人物
  • 企业网站开发费用会计分录/百度明星人气榜排名
  • 抖音seo公司帝搜平台/专业网站优化排名
  • 安阳网站建设哪家专业/百度一下就知道了官网楯
  • 做网站建设销售途径/网络培训心得体会
  • 新素材网站/关键词规划师工具
  • 公安科技信息化建设 素材 网站/免费做网站推广的软件
  • 英文外贸网站/天天seo站长工具
  • c#网站开发案例大全/思亿欧seo靠谱吗
  • 口碑好的武汉网站建设/公司网站建设需要注意什么
  • WordPress去掉你的位置/百度爱采购优化排名软件
  • 制作手机app需要学什么/seo网站页面优化包含
  • 建筑企业网站模板免费下载/今日的新闻头条10条
  • 上海做网站品牌公司有哪些/推广联盟
  • 求可以做问卷测试的网站/seo网站推广培训
  • 重庆最近新闻大事件/手机游戏性能优化软件
  • 网站被恶意解析/seo关键词优化软件app
  • 大理市政府建设办网站/seo关键词的优化技巧
  • 在VS Code中运行Python:基于Anaconda环境或Python官方环境
  • Linux——线程同步
  • connect系统调用及示例
  • 全球化2.0 | 云轴科技ZStack亮相阿里云印尼国有企业CXO专家活动
  • python学习DAY22打卡
  • Android Ntp系统校时流程