Hi everybody,
I am trying to assign an address of a function to a variable.
How can I do this in C?
Thanks!
Printable View
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;
}
Thank you!!!