Code: Show/Hide #include <stdio.h>
int main() { void *fList[2]; fList[0] = printf; fList[1] = main; printf("Location of printf: %p\n", printf); printf("Location of main: %p\n", main); printf("Location of fList[0]: %p\n", fList[0]); printf("Location of fList[1]: %p\n", fList[1]); return 0; } |
Code: Show/Hide Location of printf: 0x80482a8
Location of main: 0x8048384 Location of fList[0]: 0x80482a8 Location of fList[1]: 0x8048384 |
Code: Show/Hide int (*f)(int) = 0; int (*f2)(int) = 0; const int (*fp[2])(int) = { f, f2 }; |
Code: Show/Hide int (*const fp[2])(int) = { f, f2 }; |
Ekted wrote: |
You could also typedef a function pointer, then declare a const array of that type. |
Code: Show/Hide typedef void (__stdcall * template_func)(AnonymousStruct *);
template_func RPC[256]; // void (__stdcall * RPC [256])(AnonymousStruct *); |