标题:[求助]简单的连表题
取消只看楼主
mp3aaa
Rank: 5Rank: 5
等 级:贵宾
威 望:17
帖 子:2013
专家分:8
注 册:2006-2-15
结帖率:83.33%
 问题点数:0 回复次数:1 
[求助]简单的连表题

着里面有好多错误
帮忙看看 怎么改
#include"stdio.h"
#include"stdlib.h"
struct slist
{
int data;
struct slist *next;
};
typedef struct slist SLIST;
SLIST *creat() ;
void print(SLIST *head) ;

main()
{
SLIST *head;
head=creat();
print(head);
}
SLIST *creat()
{
int c;
SLIST *h,*s,*r;
h=(SLIST*)malloc(sizeof(SLIST));
r=h;
scanf("%d",&c);
while(c!=-1)
{
s=(SLIST*)malloc(sizeof(SLIST));
s.data=c;
r.next=s;
r=s;
scanf("%d",&c);
}
r.next='\0';
return h;
}
void print(SLIST *head)
{
SLIST *p;
p=head.next;
if(p=='\0')
printf("连表为空\n");
else{
printf("head");
double{
printf("->%d",p.data);
p=p.next;
}
while(p!='\0');
printf("->end\n");
}
}

搜索更多相关主题的帖子: head next include 
2006-11-16 22:05
mp3aaa
Rank: 5Rank: 5
等 级:贵宾
威 望:17
帖 子:2013
专家分:8
注 册:2006-2-15
得分:0 


羊肉串 葡萄干 哈密瓜!!
2006-11-17 22:58



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-103467-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.260687 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved