I found this interesting site on function pointers
The Function Pointer Tutorials - Introduction
It uses quicksort example of how to use function pointers to implement callback functions.
I read the topic on function pointers and that of the callback functions but still cannot imagine, in my ignorance of course, how to use them.
What would I pass as parameter to the traversetree function and how could it return every integer it comes across in the nodes? Or do I need to write an iterative traversetree function instead of a recursive one?
I'm really baffled by this as this is my first C assignment and also my first need to implement a program in a library instead of the normal "everything included in program" sort of thing.
For what help it may be, this is my traverse function:
Code:
/* Tree traversal */
int TraverseTree ( NODE* traverse_Node )
{
if ( traverse_Node )
{
printf ( "%i ", traverse_Node->valKey );
TraverseTree ( traverse_Node->Left );
TraverseTree ( traverse_Node->Right );
}
}
Thanks for your input