📄 11.c
字号:
#include <stdio.h>
#include<malloc.h>
typedef struct node{
char Elem;
struct node *next;
}Lnode;
void main()
{
char k;
Lnode *s,*l,*p,*q,*ftail,*tail;
s =(Lnode*) malloc(sizeof (Lnode));
s->Elem=0;
s->next=NULL;
printf("Input the first string:");
k=getchar();
while(k!=(char)(10))
{
p =(Lnode*) malloc(sizeof (Lnode));
p->Elem=k;
p->next=NULL;
if (s->next==NULL)
{
s->next = p;
ftail=p;
}
else
{ftail->next=p;ftail=p;}
k=getchar();
}
l =(Lnode*) malloc(sizeof (Lnode));
l->Elem=0;
l->next=NULL;
printf("Input the second string:");
k=getchar();
while(k!=(char)(10))
{
p =(Lnode*) malloc(sizeof (Lnode));
p->Elem=k;
p->next=NULL;
if (l->next==NULL)
{
l->next = p;
tail=p;
}
else
{tail->next=p;tail=p;}
k=getchar();
}
ftail->next=l->next;
p=s->next;
printf("\nThe concat string is:");
while(p!=NULL)
{
printf("%c",p->Elem);
p=p->next;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -