写了一个队列,结果初始化的时候就遇到问题了,吧程序简化了一下,求问大神
#include <stdio.h>
#include <stdlib.h>
struct PCB_type
{
int pid ;
int state ;
int cpu_time ;
};
typedef struct QNode
{
struct PCB_type PCB;
struct QNode * next;
}QNode;
typedef struct
{
QNode * front;
QNode * rear;
}LinkQuene;
int main()
{
QNode *Q = (QNode*)malloc(sizeof(QNode));
LinkQuene *ready;
ready->front = ready->rear = Q; //到这里就无法执行
Q->PCB.pid = 1;
printf("%d\n",ready->front->PCB.pid);
return 0;
}