[求助]有啥问题
#include<stdio.h>#include<stdlib.h>
typedef struct circle
{
char secret;
struct circle *next;
}cir;
cir *creat_Cir(cir *head);
void main()
{
cir *head,*p;
head=(cir*)malloc(sizeof(cir));
head->secret=5;
head->next=head;
p=creat_Cir(head);
p=p->next;
while(p->next!=p)
{
printf("%d\n",p->secret);
p=p->next;
}
}
cir *creat_Cir(cir *head)
{
cir *p,*s,*tail;
tail=head;
p=head;
char ch;
ch=getchar();
while(ch!='\n')
{
s=(cir*)malloc(sizeof(cir));
s->secret=ch;
s->next=p;
p=s;
}
tail->next=p;
return tail;
}