百度不出来的错误 'struct addr *(struct addr *,struct addr *)' differs in levels of i
#include <stdio.h>#include <stdlib.h>
struct addr{ //通讯录的结点
char name[30];
char street[40];
char city[20];
char state[3];
char tel[11];
struct addr *next;
};
struct addr *head,*start,*last; //定义全局变量
int menu_select(){
char s[80];
int c;
printf("1_Enter a name\n");
printf("2_Delete a record\n");
printf("3_Search\n");
printf("4_Quit\n");
do{
ptintf("\nEnter your choice:");
gets(s);
c=atoi(s);
}while(c<1||c>4); //如果做的不满意,返回继续做
return (c);
}
void enter()
{
struct addr *info;
void inputs(char*,char*,int);
int n;
for(n=0;;n++)
{
info=(struct *)malloc(sizeof(struct addr));
if(info==NULL)
{
printf("\nout of memory");
return ;
}
inputs("enter name:",info->name,30);
if(info->name[0]=='0')
break;
else{
inputs("enter street:",info->street,40);
inputs("enter city:",info->city,20);
inputs("enter state:",info->state,3);
inputs("enter tel:",info->tel,11);
start=des_store(info,start);
if(n==0)
head=start;
}
}
}
void inputs(char *pl,char *s,int count)
{
char p[40];
do{
printf("%s",pl);
gets(p);
if(strlen(p)>count)
printf("\n too long\n");
}while(strlen(p)>count);
strcpy(s,p);
}
struct addr* des_store(struct addr *i,struct addr *top)
{
if(!last)
{
last=i;
return i;
}
else{
top->next=i;
i->next=NULL;
last=i;
return i;
}
}
struct addr *find(char *name)
{
struct addr *info;
info=head;
while(info)
{
if(!strcmp(name,info->name))
return(info);
else
info=info->next;
}
return(info);
}
void search()
{
char name[40];
struct adde *info;
printf("enter name to find:");
gets(name);
if((info=find(name))==NULL)
printf("not found\n");
else{
display(info);
}
}
void deleted()
{
char s[80];
struct addr*pl,*p2,*info;
printf("enter name:");
gets(s);
info=find(s);
if(info!=NULL)
{
if(head==info)
{
head=info->next;
printf("deleted:%d\n",info->name);
free(info);
}
else{
pl=head->next;
while(info!=pl)
{
p2=pl;
pl=pl->next;
}
p2->next=pl->next;
printf("deleted:%s\n",info->name);
free(info);
}
}
else
printf("%s not find!\n",info->name);
}
void main(){
char s[80],choice;
struct addr *info;
start=last=NULL;
for(;;)
switch(menu_select()) //根据菜单返回的选项,进入不同的功能
{
case 1:enter();
break;
case 2:deleted();
break;
case 3:search();
break;
case 4:exit(0);
}
}