请问,这个程序错在哪里?
#include<stdio.h>
#include <malloc.h>
typedef int type;
typedef struct node
{type data;
struct node *next;
}lnode,*linkedlist;
//*********************************************
linkedlist linkedlistcreat()
{linkedlist head,r;
head=(lnode *)malloc(sizeof(lnode));
head->next=NULL;
r=head;
int x;
linkedlist p;
printf("请输入元素,输入0结束输入");
scanf("%type",&x);
while(x!=-1)
{p=(lnode *)malloc(sizeof(lnode));
p->data=x;
r->next=p;
r=p;
scanf("%type",&x);
}
r->next=NULL;
return head;
}
linkedlist delsame()
{
linkedlist head;
linkedlist pre,p,u;
pre=head->next;
p=pre->next;
while(p!=NULL)
if(p->data==pre->data)
{u=p;p=p->next;free(p);
}
else
{pre->next=p;
pre=p;
p=p->next;
}
pre->next=p;
return head;
}
void display()
{linkedlist head;
while(head!=NULL)
{printf("%type",head->data);
head=head->next;}
}
void main()
{linkedlist H;
H=linkedlistcreat();
H=delsame();
printf("删除后的元素是:");
void display();
}