C语言 用结构体建立 一个PCB表 然后答应 麻烦各位高手帮我看下程序段是哪里出错了 有3个错

来源:百度知道 编辑:UC知道 时间:2024/05/05 06:44:33
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
struct pcb_type
{
int id;
char name[5];
int priority;
char state[5];
};
void main()
{
void list(struct pcb_type pcb);
struct pcb_type pcb[10],*p;
int i;
for(i=1,p=pcb;i<=10;p++,i++)
{
printf("Please input the date of pcb[%d]:\n",i);
scanf("%d\n%s\n%d\n%s",&p->id,&p->name,&p->priority,&p->state);
}
for(i=1;i<=10;i++)
list(pcb[i]);
}
void list(pcb)
struct pcb_type pcb;
{
printf("%d%s%d%s",pcb.id,pcb.name,pcb.priority,pcb.state);
printf("inputting complete!\n");
}

在线等

#include <stdio.h>
struct pcb_type
{
int id;
char name[5];
int priority;
char state[5];
};
void main()
{
void list(struct pcb_type pcb);

struct pcb_type pcb[10], *p;
int i;
for(i=1,p=pcb;i<=10;p++,i++)
{
printf("Please input the date of pcb[%d]:\n",i);
scanf("%d\n%s\n%d\n%s",&(p->id),&(p->name),&(p->priority),&(p->state));
}
for(i=1;i<=10;i++)
list(pcb[i]);
}
void list(pcb)
struct pcb_type pcb;
{
printf("%d%s%d%s",pcb.id,pcb.name,pcb.priority,pcb.state);
printf("inputting complete!\n");
}

我用VC编译的可以运行!