The "prototype" that you have for
Originally Posted by keira
is there so that the compiler can check that you have a sensible function as the callback.
int (*callback)(int index, int item, void *param)
In this case, it says "callback" is a pointer, to a function that returns an in, and the function takes two integer and one void * parameter.
It really makes no difference to the compiler as such if you were to pass a function pointer to a function that takes one parameter, or 15 parameters - but because it's probably not the right thing to do, we have taught the compiler to tell us when we get it wrong.
callback itself is just a pointer - it happens to be a pointer to some function, and when it is being used later on in the code.
But for the call to "traverseWith", all it will do is pick up a 32 (or 64) bit pointer to the function you want to use, and store that so that the traverseWith function can use it to call the callback function.
Inside traversewith, you'll find some code that looks something like this:
Appologies for unaligned spacing on the assembler code.
mov param[esp], eax
mov index[esp], eax
mov item[esp], eax
mov callback[esp], eax