Skip to content

Instantly share code, notes, and snippets.

@FlyingJester
Created January 12, 2014 13:13
Show Gist options
  • Save FlyingJester/8384427 to your computer and use it in GitHub Desktop.
Save FlyingJester/8384427 to your computer and use it in GitHub Desktop.
You can't pass function pointers as void pointers. But you CAN pass function pointer pointers as void pointers.
void CallFuncPP(void *r){
void **d = (void **)r;
void(**e)(void) = (voidFunc *)d;
e[0]();
}
/////
//Example
#include<csdtio>
void print(void){
printf("Hello, world!\n");
}
int main(int argc, char *argv[]){
void(*functP)(void) = print;
CallFuncPP((void *)(&funcP));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment