Of course the find()
function should not require the caller to wrap the data in a list element.
It sounds as if you're becoming more confused about this due to the list holding void *
as its data, not sure why.
If you had a list of int
, then I guess you would expect to have a bool find(const list_el *head, int value);
function to look for a certain number. It's no different for void *
, but of course the actual comparison can be a bit more tricky since it's less well-defined what equality means.
That is, of course, why your list seems to use an application-supplied callback function to do the comparison.