Leo Linuxhnrainll.blog.chinaunix.net
hnrainll
全部博文(354)
2010年(300)
2009年(54)
大鬼不动
叶绍琛
路沐堇
HoariNes
快乐的猪
6551130
zjt_pond
K__奕__
cynthia
格伯纳
Bsolar
葫芦娃的
分类: C/C++
2010-07-07 06:55:31
#include <stdio.h> #include <stdlib.h> struct chain { int value; struct chain *next; }; struct chain *create() { struct chain *head, *tail, *p; int x; head = tail = NULL; printf("Input data.\n"); while(scanf("%d", &x) == 1) { p = (struct chain *)malloc (sizeof(struct chain)); p->value = x; p->next = NULL; if(head == NULL) head = tail = p; else tail = tail ->next; tail ->next = p; } return head; }; int main(int argc, char *argv[]) { struct chain *p, *q; q = create(); while(q) { printf("%d\n", q->value); p = q->next; free(q); q = p; } system("pause"); return 0; }
上一篇:CAN Bus Ciruit Diagram/CAN 开发板源理图
下一篇:准备开始学习PADS了,开始俺的学习笔记
登录 注册