1、单链表的基本操作#include #include typedef char date;typedef struct nodedate ch;struct node *next;list;typedef list *linklist;linklist creat()date ch;linklist head=(linklist)malloc(sizeof(list);list *p,*r;r=head;ch=getchar();while(ch!=n)p=(linklist)malloc(sizeof(list);p-ch=ch;r-next=p;r=p;ch=getchar();r-next
2、=NULL;return (head);void insert(linklist head,int i,char x)int j=0;linklist r,p;p=head-next;while(p&jnext;j+;if(!p|ji-1)exit(1);r=(linklist)malloc(sizeof(list);r-ch=x;r-next=p-next;p-next=r;void puter(linklist linker)linklist p;p=linker-next;while(p!=NULL)printf(%c ,p-ch);p=p-next;void delet(linklis
3、t head ,int i)int j=0;linklist r,p;p=head-next;while(p&jnext;j+;if(!p|ji-1)exit(1);r=p-next;p-next=r-next;free(r);int main()static int q,k;char w;printf(请输入字符穿,并以ENTER键结束n);linklist head,p,linker=creat();puter(linker);printf(请输入插入位置和插入字母n);scanf(%d %c,&q,&w);insert(linker,q,w);puter(linker);printf(n请输入删除位置的序号:n);scanf(%d,&k);delet(linker,k);puter(linker);printf(n);return 0;