Edit 2
Thanks for all the suggestions, I edited the code below from the suggestions. However, it still does not compile. But, nevertheless, many thanks for the help.
Edit
I apologize for not putting the pcb structure in the code snippet. There is a structure called pcb defined above the two previously published structures. Namely,
typedef struct pcb{
UINT32 proc;
struct pcb *link;
}pcb;
Hi,
A few minutes ago I asked about structures in C and got a quick answer. But now I am faced with another problem, namely, an error in the title of this issue. I am trying to implement a simple priority queue in C using queue arrays. However, when I try to declare a function in the pcb_pQ structure, I get the above error. I have structures clearly defined in the file I heard.
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;
The prototype of the function in the header file:
VOID pcb_pq_enqueue(pcb_pQ*, pcb*);
The impulse of the function in the .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 the sign "error: expected") before "*". This error indicates the signature of the function in the .c file, namely
VOID pcb_pq_enqueue(pcb_pQ* pcb_pQ_p, pcb* pcb_p) {
But I'm not sure why I get this error, can someone give me a hand? Many thanks.