c语言,关于工资管理系统的问题,

来源:百度知道 编辑:UC知道 时间:2024/07/07 10:32:56
#include"stdio.h"
#include"malloc.h"
#include"string.h"
#include"stdlib.h"

struct student
{
long num;
char name[20];
char bum[20];
long money;
long smoney;
struct student *next;
}

struct student *creat()//创建链表
{
struct student *p;
p=(struct student *)malloc(sizeof(struct student));
p->next=NULL;
return p;
}

这是开头一段,就在创建链表的那一行出错了,为什么??

不是这行错,是他的上一行结尾要个分号的。
#include"stdio.h"
#include"malloc.h"
#include"string.h"
#include"stdlib.h"

struct student
{
long num;
char name[20];
char bum[20];
long money;
long smoney;
struct student *next;
} ;//就是这里

struct student *creat()//创建链表
{
struct student *p;
p=(struct student *)malloc(sizeof(struct student));
p->next=NULL;
return p;
}