Reputation: 2243
//old and auqHdr are data structures of type gblAuqEntry and auQ respectively
//I traverse through the list 'auqHdr' and when I match the element 'old', I need to remove it
removeAUfromNodeAUQ(&old, &auqHdr);
//Function implementation
static void removeAUfromNodeAUQ(gblAuqEntry *old, auQ *auqH)
{
auQ *auqPtr, *prev;
int found =0;
for (auqPtr = auqH; auqPtr; auqPtr = auqPtr->nxt)
{
if (something)
prev = auqPtr;
else
{
prev->nxt = old->nxt;
found = 1;
break;
}
}
I am trying to remove the element 'old' in the list 'auqHdr'.
The error I am getting is "declaration is incompatible with previous "removeAUfromNodeAUQ"" Can someone please point out what I am doing wrong here?
Thanks
Upvotes: 2
Views: 95
Reputation: 727047
If you call the function before declaring it, C implies a return type of int
, not void
.
You should add this declaration in the header or at the top of your file to address the problem:
static void removeAUfromNodeAUQ(gblAuqEntry *old, auQ *auqH);
Upvotes: 2
Reputation: 124790
Well, if your code is exactly as you posted, then this:
removeAUfromNodeAUQ(&old, &auqHdr);
Is not a function call, it is a function declaration. You then define it, but with a different signature. In that context you are forward declaring a function. C assumes a return type of int for you.
Upvotes: 2