|  | 
 
1鱼币 
| #include "stdio.h" int main(){
 typedef int ElemType;
 typedef struct node
 {
 ElemType data;
 struct node *next;
 }slink;
 slink *cresclink(int n)
 {
 slink *head,*p,*s;
 int i;
 p=head=(slink *)malloc(sizeof(slink));
 for(i=1;i<=n;i++)
 {
 s=(slink *)malloc(sizeof(slink));
 scanf("%d",&s->data);
 p->next=s;
 p=s;
 }
 p->next=head;
 return head;
 }
 int insert(slink *head,int i,ElemType x)
 {
 slink *p,*q;int j;
 if(i<1)return 0;
 p=head;j=0;
 while(p->next!=head&&j<i-1)
 {p=p->next;j++;}
 if((p->next!=head)||(p->next==head&&j==i-1))
 {
 q=(slink *)malloc(sizeof(slink));
 q->data=x;
 q->next=p->next;
 p->next=q;
 return 1;
 }
 else return 0;
 }
 int delete(slink *head,int i,ElemType *e)
 {
 slink *p,*q;int j;
 p=head;j=0;
 while(p->next!=head&&j<i-1)
 {p=p->next;j++;}
 if(p->next==head)return 0;
 q=p->next;
 p->next=q->next;
 *e=q->data;
 free(q);
 return 1;
 }
 void list(slink *head)
 {
 slink *p=head->next;
 while(p!=head)
 {printf("%4d",p->data);
 p=p->next;}
 printf("\n");
 }
 return 0;
 }
 
   兄弟们问一下 问题出在哪;基本不懂;完全按照课本上面打的
 | 
 |