I'm reading the Algorithm Design Manual and in chapter 3, the following code snippet appears. It has to do with removing an item from a linked-list. The question isn't related to data-structures, but just to a single line of code where two variables are declared I think. I've stripped the non-relevant parts of the code for brevity.
list *search_list(list *l, item_type x) {
// This function just searches the list x
}
list *predecessor_list(list *l, item_type x) {
// This function simply returns the predecessor of x or NULL
}
delete_list(list **l, item_type x) {
list *p; /* item pointer */
list *pred; /* predecessor pointer */
list *search_list(), *predecessor_list(); // What are these declarations?
p = search_list(*l,x);
// Code to delete the node if found is here
}
My question is in the delete_list function
, specifically, the line list *search_list(), *predecessor_list();
. What is happening on that line? I'm guessing it's a pointer to a function, but my understanding is you are supposed to declare the function pointer with the appropriate parameters. Also, assuming I am correct, why are those lines even needed?