Hi everybody,
I am trying to assign an address of a function to a variable.
How can I do this in C?
Thanks!
This is a discussion on Returning address of Function. Pointers to Functions. within the C Programming forums, part of the General Programming Boards category; Hi everybody, I am trying to assign an address of a function to a variable. How can I do this ...
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; }
If I have eight hours for cutting wood, I spend six sharpening my axe.
Thank you!!!