Hi everybody,
I am trying to assign an address of a function to a variable.
How can I do this in C?
Thanks!
Hi everybody,
I am trying to assign an address of a function to a variable.
How can I do this in C?
Thanks!
Code:#include <stdio.h> int func(int a) { return a; } typedef int(*MyFuncType)(int); int main() { MyFuncType pFunc; pFunc = func; printf("%d", pFunc(5)); return 0; }
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
Thank you!!!