#include<stdio.h>
#include<malloc.h>
#include<string.h>
typedef struct student
{
int score;
struct student*next;
}L;
L*create(int date)
{
L*p=(L*)malloc(sizeof(L));
if(p=NULL)
{
printf("malloc fair!");
return NULL;
}
memset(p,0,sizeof(L));
p->score=date;
p->next=NULL;
}
void tailinsert( L *ph,L *c)
{
L*p=ph;
while(p->next!=NULL)
{
p->next=p;
}
p->next=c;
}
void print(L*ph)
{
L*p=ph;
p=p->next;
while(p!=NULL)
{
printf("%d\n",&p->score);
p=p->next;
}
printf("%d\n",&p->score);
}
void detect(L*ph,int date)
{
L*pr=ph;
L*p=ph->next;
if(p=NULL)
{
printf("数据为空,无法删除\n");
memset(p,0,sizeof(L));
}
else
while(1)
{
pr=p;
p=p->next;
if(p=NULL)
{
printf("找不到数据\n");
return;
}else
pr->next=p->next;
free(p);
}
}
int main()
{
L*m=create(0);
L*infor;
while(2)
{
printf("请输入您想要的数据\n");
scanf("%d\n",&infor->score);
tailinsert(m,infor->score);
printf("要继续吗?\n1.yes\t2.no");
int i=getchar();
if(i==2)
{
break;
}
print(m);
}
printf("请输入要删除的数据\n");
scanf("%d\n",&infor->score);
detect(m,infor->score);
return 0;
}
求求各位大佬们有没有人帮帮孩子,我真的不知道该怎么处理这个东西
他一直说错误error C2664: 'tailinsert' : cannot convert parameter 2 from 'char' to 'struct student *'