#include<stdio.h>
#include<stdlib.h>
typedef int DataType;
typedef struct node
{
DataType data;
struct node * next;
}ListNode;
typedef ListNode * LinkList;
LinkList jianbiao(int n)
{
int i;
ListNode *head,*s,*rear;
head=(ListNode *)malloc(sizeof(ListNode));
rear=head;
for(i=1;i<=n;i++)
{
s=(ListNode *)malloc(sizeof(ListNode));
scanf("%d",&s->data);
rear->next=s;
rear=s;
}
rear->next=NULL;
return head;
}
ListNode *hebing(ListNode *head_a, ListNode *head_b)
{
ListNode *p, *q, *head;
head=(ListNode *)malloc(sizeof (ListNode));
if(head==NULL)
{
printf(“申请空间失败!”);
return head;
}
head->next=NULL;
p=head_a->next;
q=head_b->next;
两个单链表合并为一个单链表
最新推荐文章于 2023-05-19 11:32:48 发布