I am practicing some programs from a book on Algorithms using C programming.
I see the following function:
void list_init(List *list, void (*destroy)(void *data)) {
/* Initialize the list. */
list->size = 0;
list->destroy = destroy;
list->head = NULL;
list->tail = NULL;
return;
}
which is later called as:
list_init(&list, free);
I thought free
is a function in C language that is described as: void free(void *ptr)
and therefore requires an argument.
So, why is free
provided as an argument to list_init
by itself? Can someone help me understand this please?
Thanks.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…