编一个输出链表的函数print
#include<stdio.h>#include<stdlib.h>
#define LEN sizeof(struct Student)
struct Student
{
long num;
float score;
struct Student *next;
};
int n;
void print(struct Student *head)
{
struct Student *p;
printf("\nNOW,These %d records are:\n",n);
p=head;
if(head!=NULL)
do
{
printf("%ld %5.1f\n",p->num,p->score);
p=p->next;
}while(p!=NULL);
}
为什么编译时有错呢?希望有高手指点,谢谢!
错误提示如下:
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/file-1.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.