奇门遁甲玄武代表:大虾帮忙哦!在C++环境下运行以下C程序,出现以下错误,为什么啊?

来源:百度文库 编辑:高考问答 时间:2024/04/29 08:33:03
程序如下:
#include<malloc.h>
#include<stdio.h>
#define null 0
#define len sizeof(struct student)
struct student
{
long num;
float score;
struct student *next;

};
int n;
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(len);
scanf("%ld,%f",p1->num,p1->score);
head=null;
while(p1->num!=0)
{
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student*)malloc(len);
scanf("%ld,%f",&p1->num,&p1->score);
}
p2->next=null;
return(head);
}
联编出错:
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/ad.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

ad.exe - 2 error(s), 0 warning(s)
为什么啊?谢谢!

没有主函数(main),即是程序没有运行入口,加上main函数就没这个问题了

主程序呢?

符号 打的太乱了 都不好看了

the c progaming must have main function before you
linking it to exe.