注册 登录
编程论坛 数据结构与算法

为什么我输入的东西都输不出来,谁帮我看一下程序

sunnyyw 发布于 2010-01-09 16:03, 622 次点击
:#include <stdio.h>
#define NULL 0
#define LEN sizeof(struct canode)
typedef struct canode
{char ca;
 struct canode *next;
}Cnode,*Clist;
creat()
{Cnode *rear,*s,*lc,*p;
 char c;
 lc=(struct canode *)malloc(LEN);
 rear=lc;
 printf("Ener a paper,#,END");c=getchar();s->ca=c;
 while(c!='#')
  {rear->next=s;
   rear=s;
   c=getchar();
   s->ca=c;}
 rear->next=NULL;
 return(lc);
}
print(Cnode *l)
{struct Clist *p;
 p=l;
 p=p->next;
 if(p!=NULL)
  do{printf("%c",p->ca);
     p=p->next;
     }while(p!=NULL);
}
void main()
{Clist *L;
 int p1;
 L=creat();
 print(L);}
1 回复
#2
hui_302010-01-21 11:20
printf("Ener a paper,#,END");c=getchar();s->ca=c;
while(c!='#')
  {rear->next=s;
   rear=s;
   c=getchar();
   s->ca=c;}
rear->next=NULL;
return(lc);
}



这段代码有点问题


1