#include
#define MAXSIZE 100
#define OK 1
#define NULL 0
#define OVERFLOW -2
typedef struct
{
int data;
struct Lnode *next;
int Length;
}Lnode,*Linklist;
int main()
{
void scanf1(Linklist *L);
void display(Linklist *L);
Linklist *La;
scanf1(&La);
display(&La);
}
void scanf1(Linklist *L)
{
int node;
Linklist p;
L=(Linklist*)malloc(sizeof(Lnode));
L->next=NULL;
printf("输入第一个元素的值\n");
scanf("%d",&node);
while(node!=0)
{
p=(Linklist*)malloc(sizeof(Lnode));
p->data=node;
p->next=L->next;
L->next=p;
printf("输入元素,以0终止\n");
scanf("%d",&node);
}
}
void display(Linklist *L)
{
Linklist *p;
p=L->next;
while(p)
{
printf("%d\n",*p);
p=p->next;
}
}
H:\单链.c(24) : error C2082: redefinition of formal parameter 'L'
H:\单链.c(28) : error C2223: left of '->next' must point to struct/union
H:\单链.c(33) : warning C4047: '=' : 'struct Lnode *' differs in levels of indirection from 'struct Lnode ** '
H:\单链.c(35) : error C2223: left of '->next' must point to struct/union
H:\单链.c(36) : error C2223: left of '->next' must point to struct/union
H:\单链.c(44) : error C2223: left of '->next' must point to struct/union
H:\单链.c(48) : error C2223: left of '->next' must point to struct/union