c语言错误missiing ';' before type

来源:百度知道 编辑:UC知道 时间:2024/09/26 14:09:15
程序如下:#include "stdio.h"
#include "stdlib.h"
typedef struct Process
{
char name[10];
int time;
int num;
char state;
struct Process *next;
}Process;
void out_L(Process *L);
//Process *treat();
Process *L;

Process *treat()
{
struct Process *h,*s,*p;
int i,n;
h=(Process *)malloc(sizeof(Process));
h->next=NULL;
printf("欢迎使用过程调庋程序!请输入任意数字继续!\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
p=h;
s=(Process *)malloc(sizeof(Process));
s->next=NULL;
printf("请输入进程的名、要求运行的时间、优先数和壮态:\n");
scanf("%s",s->name);
scanf("%d",s->time);
scanf("%d",s->num);
scanf("%c",s->state);
if(p->next==NULL)
{
p->next=s;
p=p->next;

Process *treat() 最后少一个大括号"}"

结构体名和映射名相同了,最好分开。
typedef struct Process
{
char name[10];
int time;
int num;
char state;
struct Process *next;
}Process;

typedef struct PROCESS
{
char name[10];
int time;
int num;
char state;
struct Process *next;
}Process;