Quantcast
Channel: Function pointer as parameter - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by Nikolai Fetissov for Function pointer as parameter

Replace void *disconnectFunc; with void (*disconnectFunc)(); to declare function pointer type variable. Or even better use a typedef:typedef void (*func_t)(); // pointer to function with no args and...

View Article



Answer by GManNickG for Function pointer as parameter

The correct way to do this is:typedef void (*callback_function)(void); // type for concisenesscallback_function disconnectFunc; // variable to store function pointer typevoid...

View Article

Answer by WhirlWind for Function pointer as parameter

You need to declare disconnectFunc as a function pointer, not a void pointer. You also need to call it as a function (with parentheses), and no "*" is needed.

View Article

Function pointer as parameter

I try to call a function which passed as function pointer with no argument, but I can't make it work.void *disconnectFunc;void D::setDisconnectFunc(void (*func)){ disconnectFunc = func;}void...

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images