Sep 18, 2011 at 12:21am
I've never seen a function declared like this, specifically the (*visit)(int&)
|
void inorder(void (*visit)(int &));
|
what is this called? how does it work?
The way I am looking at it I see: dereference visit, multiply it by an int.... but it makes no sense to me in the context it's used.
Last edited on Sep 18, 2011 at 12:30am
Sep 18, 2011 at 12:46am
void (*visit)(int &) looks like a function pointer to me. One of the obscure abilities of C/C++.
Could you post the function? You only have the prototype there.
Sep 18, 2011 at 12:51am
ah ok. thanks guys. I've never used a function pointer before. Now I know what it is :)