正在加载图片...
定义结构体类型: struct node head,p;头插法创建链表 struct node head null int d scant(%d”,&d); int data: while(d=-1) struct node *next p=(struct node )malloc(sizeof(struct node)); p->data=d; if(h== NULL) p->neXt NULL. else p->next= h;h=p scanf(“%d”,&d”)定义结构体类型: struct node { int data; struct node *next; } struct node *head, *p; head = NULL; int d; scanf(“%d”, &d); while(d != -1) { p = (struct node *)malloc(sizeof(struct node)); p->data = d; if(h == NULL) { h = p; p->next = NULL; } else { p->next = h; h = p; } scanf(“%d”, &d”); } 头插法创建链表
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有