文章
28
粉丝
230
获赞
23
访问
242.6k
#include <stdio.h>
#include <stdlib.h>
typedef struct LNode
{
int data;
struct LNode * next;
}LNode;
int main(int argc, char const *argv[])
{
int N1,N2,DATA;
LNode *p,*r,*s;//p作为搬用结点
LNode *C1=(LNode *)malloc(sizeof(LNode));
LNode *C2=(LNode *)malloc(sizeof(LNode));
C1->next = NULL;
C2->next = NULL;
r=C1;
s=C2;
scanf("%d",&N1);
while(N1!=0){
p =(LNode *)malloc(sizeof(LNode));
p->next=NULL;
scanf("%d",&DATA);
p->data = DATA ;
r->next = p;
r=p;
N1--;
}
scanf("%d",&N2);
while(N2!=0){
p = (LNode *)malloc(sizeof(LNode));
p->next=NULL;
scanf("%d",&DATA);
p->data = DATA ;
s->next = p;
s=p;
N2--;
}
sortlist(C1->next,C2->next);
return 0;
}
void sortlist(LNode *linkList1,LNode *linkList2){
LNode * t = (LNode *)malloc(sizeof(LNode));
t->next = NULL;
LNode *q;
q=t;
while(linkList1 != NULL && linkList2 != NULL){
if (li...
登录后发布评论
暂无评论,来抢沙发