fn is a pointer to a function taken from left to right, int& and int* , which returns nothing.
You assign the add function to fn .
You can call the add function through a pointer using the same syntax as you would if you used add .
One application of this method is to model callback functions. For example, qsort requires a callback function for a sort predicate. Function pointers are more common in C than in C ++, where there are other methods such as function objects, templates, lambdas, and even std::function .
Bathsheba
source share