#开始

·  简单的创建链表

#代码

  

 #include<conio.h>
#include<stdio.h>
#include<stdlib.h> struct Str
{
char name[];
int sex;
int id;
Str * next;
}; void printStruct(Str *str) //输出链表
{
Str *strTemp = str;
while(strTemp->next)
{
printf("=========print=============\n");
printf("id: %d\n",strTemp->id);
printf("name: %s\n",strTemp->name);
printf("sex: %d\n",strTemp->sex);
strTemp = strTemp->next;
}
} int main()
{
Str* strFirst = (Str*)malloc(sizeof(Str));
Str* strTemp = strFirst;
while(strTemp->next) //创建链表
{
printf("=========================\n");
printf("输入id:");
scanf("%d",&strTemp->id);
if(strTemp->id == ) //如果输入id == 0 就退出输入
{
strTemp->next = NULL; //给next赋值NULL 并且返回到循环的最开始的位置
continue;
}
printf("输入name:");
scanf("%s",strTemp->name); printf("输入sex:");
scanf("%d",&strTemp->sex); strTemp->next=(Str*)malloc(sizeof(Str));
strTemp = strTemp->next;
}
printStruct(strFirst); //输出链表 _getch();
return ;
}

#运行环境

  win7 32位

  VS2010

最新文章

  1. Client病毒已感染超7万人 暗扣费并频弹广告
  2. json字符串返回到js中乱码
  3. 堆糖瀑布流完整解决方案(jQuery)
  4. Exception mybatis 配置文件:&lt;typeAlias alias=&quot;***&quot; type=&quot;***&quot;/&gt; 重复配置
  5. ios学习笔记
  6. JSON未定义解决办法
  7. 20180519001 - DataTable Group by功能参考
  8. Java核心技术卷一基础知识-第5章-继承-读书笔记
  9. Linux安装Tomcat-Nginx-FastDFS-Redis-Solr-集群——【第十集之Nginx反向代理原理】(有参考其他文章)
  10. mac安装pyspider报错
  11. SQL Server 2016 发送邮件功能
  12. [LeetCode] 744. Find Smallest Letter Greater Than Target_Easy tag: **Binary Search
  13. 理解本真的 REST 架构风格
  14. Go语言学习之5 进阶-排序、链表、二叉树、接口
  15. 20171126--fragment的小项目
  16. (转)CloudStack 安装及使用过程中常见问题汇总
  17. Deep Learning 教程(斯坦福深度学习研究团队)
  18. VS2017专业版使用最新版Qt5.9.2教程
  19. python为什么需要reload(sys)后设置编码
  20. Hadoop Streaming:aggregate

热门文章

  1. Mahmoud and Ehab and the message
  2. (转)java垃圾回收二
  3. 基于PO和单例设计模式用python+selenium进行ui自动化框架设计
  4. js -- 时间转年月日
  5. 使用命令把SpringBoot项目打包成可运行的jar包(简洁,操作性强)
  6. python修改文件后缀名
  7. 题解【洛谷P1038/CJOJ1707】[NOIP2003提高组]神经网络
  8. MyEcplise中编码格式的修改问题
  9. 为什么各家银行都抢着办理ETC业务?
  10. 【转载】Java容器的线程安全