69,382
社区成员
发帖
与我相关
我的任务
分享
# include <stdio.h>
# include <stdlib.h>
typedef struct node { /* 定义进程控制块PCB */
char name[10];
char state; //进程状态
int priority; //进程 优先权,越大优先权越高
int alltime; //运行完进程需要的时间
int rtime;
struct node* next;
}*PCB,pcb;
pcb p;
void Initpcb(pcb* head)//初始化队列
{
/* head=(pcb*)malloc(sizeof(pcb));
if(!head){
printf("申请模块空间失败!");
exit(1);
}*/
head->next=NULL;
head->rtime=8989;
}
void Insertpcb(pcb* head) //把进程插入到队列中
{
printf("\n\n%d\n\n",head->next);//本来我初始化时已经把这个初始化为零了,怎么不是啊。应该是参数传递 错 了。可是我以前这样用是可以的怎么现在不可以了啊??
}
int main()
{
pcb head;//定义
Initpcb(&head);//初始化
Insertpcb(&head);//插入数据到队列
return 0;
}