sinat_35459112 2016-06-29 04:42 采纳率: 0%
浏览 1557

求教c语言,编译已经没错了,但是连接的时候有两个错误,导致无法运行,请帮我看一下

#include
#include
#include
#include
#define ASK(top)
#define LEN sizeof(ADDR)

extern int count;
typedef struct address
{char name[8];
char tel[20];
struct address *next;
}ADDR;
struct address *head;
struct address *p; int n;
ADDR *input()
{

p=head;
while(p!=NULL)
{scanf("%s %s\n",p->name,p->tel);
p=p->next;
n++;}
return head;
}

void display(ADDR *head)
{
printf("\nNow,These %d records are:\n",n);
p=head;
if(head!=NULL)
do
{printf("%s %s\n",p->name,p->tel);
p=p->next;
}while(p!=NULL);
}
ADDR del(ADDR *head)
{ char name[8];
if(head==NULL)
{printf("\nlist null!\n");return *head;}
p=head;
while(p!=NULL)
{
int j;char str1[8];char str2[8];
for(j=0;j {str1[j]=name[j];str2[j]=name[j];}
if(strcmp(str1,str2)==0)
{if(p==head) head=p->next;
else p=p->next;
printf("delete:%s %s\n",p->name,p->tel);
n=n-1;
}
else p=p->next;
}
return *head;
}
int handle_menu(ADDR *)
{
int c;
printf("\n1.input address's data\n");
printf("\n2.display address's data\n");
printf("\n3.delete address's data\n");
printf("\n4.Goodbye!");
printf("please input your selecion 1-5:");
scanf("%d\n",&c);
return c;
}
void main()
{
ADDR *top;
ASK(top);top=head;
top->next=NULL;
count=0;

handle_menu(top);
int d;
for(;;)
{d=handle_menu(top);
switch(d)
{case 1:input();break;
case 2:display(top);break;
case 3:del(top);break;
case 4:printf("Goodbye!");
default:printf("input error!please input again!\n");break;
}
}
}

  • 写回答

4条回答 默认 最新

  • powerhaha 2016-06-29 04:58
    关注

    extern int count;
    在别的文件里有定义吗?
    把链接的错误信息也贴上来吧

    评论

报告相同问题?

悬赏问题

  • ¥15 用三极管设计—个共射极放大电路
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示