# 两个链表之间问题(线性表)

m个数表示A链表中的m个数据元素。

n个数表示B链表中的n个数据元素。

`````` 1 3 5

11

13 5 14 62 3 43 71 5 72 34 5

15

5 20 3 53 7 81 5 42 6 8 4 6 9 10 23
``````

``````5 20 3 53 62 3 43 71 5 72 34 5 7 81 5 42 6 8 4 6 9 10 23

``````

``````#include<stdio.h>
#include<malloc.h>

struct node
{
int data;
struct node *next;
};

struct node *creat(int m){
while((m--)&&(p=(struct node *)malloc(sizeof(struct node)) , scanf("%d",&p->data)!=EOF)){
q->next = p;
q = p;
}
q->next = NULL;
}

int main(){
int i,len,j;
int m,n;

scanf("%d%d%d;",&i,&len,&j);
scanf("%d",&m);
scanf("%d",&n);
while(--i){
p = p->next;
q = q->next;
}
while(len--){
q = q->next;
}
p->next = q->next;
while(q->next != NULL)
q = q->next;
while(--j)
p = p->next;
q->next = p->next;
while(p != NULL){
printf("%d ",p->data);
p = p->next;
}
return 0;
}``````

``````#include<stdio.h>
#include<malloc.h>

struct node
{
int data;
struct node *next;
};

struct node *creat(int m){
while((m--)&&(p=(struct node *)malloc(sizeof(struct node)) , scanf("%d",&p->data)!=EOF)){
q->next = p;
q = p;
}
q->next = NULL;
}

int main(){
int i,len,j;
int m,n;

scanf("%d%d%d;",&i,&len,&j);
scanf("%d",&m);
scanf("%d",&n);
while(--i){
p = p->next;
q = q->next;
}
while(len--){
q = q->next;
}
p->next = q->next;
while(q->next != NULL)
q = q->next;
while(--j)
p = p->next;
q->next = p->next;