Edit 2
Thanks for all the suggestions, I edited the code below from the suggestions given. However, it still doesnt seem to compile. But nevertheless, thanks a lot for the help hands.
Edit
I apologize for not putting the pcb struct into the code snippet. There is a struct called pcb defined in above the two structs I originally posted. Namely,
typedef struct pcb{
UINT32 proc;
struct pcb *link;
}pcb;
Hi,
I asked a question regarding structs in C a few minutes ago and got an answer blazing fast. But now I'm facing another problem, namely the error in the title of this question. I'm trying to implement a simple priority queue in C using arrays of queues. However, when I try to declare a function on pcb_pQ structure, I get the above error. I have the structs clearly defined in the heard file.
In the header file:
typedef struct pcb_Q{
pcb *head;
pcb *tail;
SINT32 size;
} pcb_Q;
typedef struct pcb_pQ {
pcb_Q queues[5];
SINT32 size;
} pcb_pQ;
Function prototype in header file:
/*priority queue operations*/
VOID pcb_pq_enqueue(pcb_pQ*, pcb*);
Function impelmentation in .c file:
VOID pcb_pq_enqueue(pcb_pQ* pcb_pQ_p, pcb* pcb_p) {
pcb_Q* pcb_Q_p;
int priority;
priority = pcb->proc_priority;
pcb_Q_p = &pcb_pQ->queues[priority];
pcb_enqueue(pcb_Q_p, pcb);
}
When I try to compile the above code, I get an "error: expected ')' before '*' token". This error is pointing to the function signature in the .c file, namely
VOID pcb_pq_enqueue(pcb_pQ* pcb_pQ_p, pcb* pcb_p) {
But I am not sure why I am getting this error, could someone give me a hand? Thanks a lot.