C question: error: expected ')' before '*' token
Posted
by lhw
on Stack Overflow
See other posts from Stack Overflow
or by lhw
Published on 2010-05-24T05:40:02Z
Indexed on
2010/05/24
5:50 UTC
Read the original article
Hit count: 392
===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{
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 *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, pcb* pcb) {
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, pcb* pcb) {
But I am not sure why I am getting this error, could someone give me a hand? Thanks a lot.
© Stack Overflow or respective owner