I have encountered the following code:
delete_list(list **l, item_type x)
{
list *p; /* item pointer */
list *pred; /* predecessor pointer */
list *search_list(), *predecessor_list();
p = search_list(*l,x);
if (p != NULL) {
pred = predecessor_list(*l,x);
if (pred == NULL) /* splice out out list */
*l = p->next;
else
pred->next = p->next;
free(p); /* free memory used by node */
}
}
I couldn't quite understand what this line means:
list *search_list(), *predecessor_list();
Is this a function declaration? If yes;
If this is not a function declaration, then what is this?
Yes it's a couple of function prototype declarations.
And as any declaration you can have them inside a function. It's function definitions (i.e. their implementation) you can't have inside other functions.
As for the argument mismatch, that's how C works. If you don't declare any arguments then the function will be declared to have an unknown number of arguments of unknown type, and you can really call them passing just about anything and the compiler won't know if it's right or wrong.