#include <stdio.h>
#include <stdlib.h>
///链串插入和删除和连接
///adc mn dfe
typedef char datatype;
typedef struct node
{
datatype data;
struct node *next;
}node;
typedef node *linkstr;
///创建字符串
void createstr(linkstr *s)
{
///*s linkstr的内容
char ch;
node *p,*r; ///p,r,linkstr(*s)都是节点
*s=NULL; ///*s记录第一个节点
r=NULL;///初始化节点为空
while((ch=getchar())!='\n')
{
//p=(linkstr)malloc(sizeof(node));
p=(node*)malloc(sizeof(node));
p->data=ch;
if(*s==NULL) ///执行第一次
{
*s=p;
r=p;
}
else
{
r->next=p; ///划线
r=p;
}
}
if(r!=NULL)
{
r->next=NULL;
}
}
linkstr strinsert(linkstr *s,int i,linkstr t)
{
int k=1;
linkstr p,q;
p = *s; ///p为s串的第一个节点
///用p查找第i-1个位置
while(p&&k<i-1)
{
p=p->next;
k++;
&
#include <stdlib.h>
///链串插入和删除和连接
///adc mn dfe
typedef char datatype;
typedef struct node
{
datatype data;
struct node *next;
}node;
typedef node *linkstr;
///创建字符串
void createstr(linkstr *s)
{
///*s linkstr的内容
char ch;
node *p,*r; ///p,r,linkstr(*s)都是节点
*s=NULL; ///*s记录第一个节点
r=NULL;///初始化节点为空
while((ch=getchar())!='\n')
{
//p=(linkstr)malloc(sizeof(node));
p=(node*)malloc(sizeof(node));
p->data=ch;
if(*s==NULL) ///执行第一次
{
*s=p;
r=p;
}
else
{
r->next=p; ///划线
r=p;
}
}
if(r!=NULL)
{
r->next=NULL;
}
}
linkstr strinsert(linkstr *s,int i,linkstr t)
{
int k=1;
linkstr p,q;
p = *s; ///p为s串的第一个节点
///用p查找第i-1个位置
while(p&&k<i-1)
{
p=p->next;
k++;
&