在主函数里面第十九行20行
19 16 C:\Users\Lenovo\Desktop\未命名1.cpp [Error] expected ')' before ';' token
是怎么回事呀,怎么改
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
typedef struct Node
{
int data;
struct Node* next;
}Node, *Linklist;
void CreatList(Linklist* L);
Linklist ListMerge(Linklist L1, Linklist L2);
void Print(Linklist L);
int amp;
int main()
{
Linklist L1, L2, L3;
CreatList(&L1);
CreatList(&L2);
L3 = ListMerge(L1,L2);
Print(L3);
return 0;
}
void CreatList(Linklist* L)
{
//使用尾插法建立一个带头结点的单链表
Linklist p, s;
*L = (Linklist) malloc(sizeof(Node));
p = *L;
do
{
s = (Linklist) malloc(sizeof(Node));
scanf("%d", &s->data);
if (s->data == -1)
{
free(s);
break;
}
p->next = s;
p = s;
} while (1);
p->next = NULL;
}
Linklist ListMerge(Linklist L1, Linklist L2)
{
Linklist L3, p, p1, p2;
L3 = (Linklist) malloc(sizeof(Node));
p = L3;
p1 = L1->next;
p2 = L2->next;
while (p1 || p2)
{
if (p1 == NULL)
{
//L1单链表到头了
p->next = p2;
p2 = NULL;
}
else if (p2 == NULL)
{
//L2单链表到头了
p->next = p1;
p1 = NULL;
}
else
{
if (p1->data < p2->data)
{
p->next = p1;
p = p->next;
p1 = p1->next;
}
else
{
p->next = p2;
p = p->next;
p2 = p2->next;
}
}
}
free(L1);
free(L2);
return L3;
}
void Print(Linklist L)
{
Linklist p;
p = L->next;
if (p == NULL)
{
printf("NULL");
return;
}
printf("%d", p->data);
p = p->next;
while (p)
{
printf(" %d", p->data);
p = p->next;
}
}