帮忙看看。。。。

renbin5566 2010-06-12 03:03:40
# 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);//本来我初始化时已经把这个初始化为零了,怎么不是啊。应该是参数传递 错 了。可是我以前这样用是可以的怎么现在不可以了啊??
PCB p;
PCB ptr1,ptr2;

p=input();

}

int main()
{
pcb head;//定义
Initpcb(&head);//初始化

Insertpcb(&head);//插入数据到队列
return 0;

}
这样传递参数为什么不正确啊???以前这样用还可以的呢?
...全文
38 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
renbin5566 2010-06-12
  • 打赏
  • 举报
回复
谢谢、、、知道了
太乙 2010-06-12
  • 打赏
  • 举报
回复
# 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;

}

69,382

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧