How to initialize variable in struct?
Hi,
I am programming an OSP project, but I do not know how to initialize a variable in struct. Here is the code:
Code:
cpu.h
typedef struct pcb_node PCB;
extern struct pcb_node {
int pcb_id; /* PCB id */
int size; /* process size in bytes; assigned by SIMCORE */
int creation_time; /* assigned by SIMCORE */
int last_dispatch; /* last time the process was dispatched */
int last_cpuburst; /* length of the previous cpu burst */
int accumulated_cpu;/* accumulated CPU time */
PAGE_TBL *page_tbl; /* page table associated with the PCB */
STATUS status; /* status of process */
EVENT *event; /* event upon which process may be suspended */
int priority; /* user-defined priority; used for scheduling */
PCB *next; /* next pcb in whatever queue */
PCB *prev; /* previous pcb in whatever queue */
int *hook; /* can hook up anything here */
};
-------------------------------------------------------------------
cpu.c
PCB *pcb;
pcb->priority=0; //Error here
How can fix this error?
Thanks