链表---理论
发布日期:2021-06-29 05:35:35
浏览次数:2
分类:技术文章
本文共 614 字,大约阅读时间需要 2 分钟。
1学习网址
1:
2 链表的创建
#include#include #include struct node { int num;struct node *next;};struct node *create(int n){ int i; struct node *head=NULL; struct node *mid,*tail; for(i=n;i>0;i--) { mid=(struct node*)malloc(sizeof(struct node)); if(mid==NULL) { perror("mid"); exit(-1); } scanf("%d",&(mid->num)); if(head==NULL) head=mid; else tail->next=mid; tail=mid; } tail->next=NULL; return head;}int main(int argc,char** argv){ int n; struct node *p; scanf("%d",&n); p=create(n); while(p) { printf("%d ",p->num); p=p->next; } printf("\n"); return 0;}
转载地址:https://blog.csdn.net/zhi_Alanwu/article/details/104854560 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
路过,博主的博客真漂亮。。
[***.116.15.85]2024年04月01日 00时56分26秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
Problem 1004 成绩与等级
2019-04-29
Problem 1005 字符串
2019-04-29
Problem 1007 字典序
2019-04-29
Problem 1008 年龄范围
2019-04-29
Problem 1010 字符串II
2019-04-29
割圆法求π
2019-04-29
公式法求π
2019-04-29
汉诺塔问题
2019-04-29
Problem 1011 进制间的转换
2019-04-29
Problem 1012 字符串III
2019-04-29
大数相乘
2019-04-29
将博客搬至CSDN
2019-04-29
jsp中标签意思
2019-04-29
煤球数目
2019-04-29
如何避免成为一个低级的码农?
2019-04-29
程序员的你一定要记住:你所说的每一句话都会被传出!
2019-04-29
一线 IT 公司开发转管理,我是怎么从 0 到 1 的?
2019-04-29
四平方和
2019-04-29
交换瓶子
2019-04-29
报纸页数
2019-04-29