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 UE5#if WITH_EDITOR导致打包的功能不可用
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题
  • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面
  • ¥15 算法题:数的划分,用记忆化DFS做WA求调
  • ¥15 chatglm-6b应用到django项目中,模型加载失败
  • ¥15 CreateBitmapFromWicBitmap内存释放问题。
  • ¥30 win c++ socket