c++ - what does the void(*f) mean in -> "methodName( void (*f)(const Datatype&));"? -


so, i'm looking @ 1 of codes professor gave me, don't know void(*f) means, clarify?

template<class t> void binarytree<t>::inorder( void (*f)(const t&), btnode<t> *node ) const //<-- right here {   if (!node)     return;   inorder(f, node->left);    f(node->elem);   inorder(f, node->right); } 

it pointer function returning void, , taking const t& parameter. name of pointer if f.

void foo(const t&);   // function declaration  void (*f)(const t&);  // function pointer  f = &foo;             // can assign &foo f, return type , signature match 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -