At the beginning, my code looked like this,and I compiled the code using gcc
struct pcb{
int pid; /* process id */
int ppid; /* parent process id */
int prio; /* priority */
};
/* process node */
struct pnode{
pcb *node;
pnode *sub;
pnode *brother;
pnode *next;
};
And it sends the message that unknown type name 'pcb
'. Then I modify the code according to what I found in the Internet, and my revised code is as follows.
typedef struct pcb{
int pid; /* process id */
int ppid; /* parent process id */
int prio; /* priority */
int state; /* state */
int lasttime; /* last execute time */
int tottime; /* totle execute time */
} pcb;
/* process node */
typedef struct pnode{
pcb *node;
pnode *sub;
pnode *brother;
pnode *next;
} pnode;
But new errors occurred; the compiler sent the message about unknown type name 'pnode
' to me. I don't know how to using my structure variable when I define a structure. Please give me some tips.