How could the function caller control the behavor of a function?

1. Provide a flag as an argument to the function, but this is not
flexible because
the function can only perform a fixed set of comparison (ascending
and descending).
2. The much nicer way is to let the caller pass a function to the
function
For details, please see the following:
http://www.cprogramming.com/tutorial/function-pointers.html

No comments:

Post a Comment