This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

function pointer

hi all,

do you think i can work around function pointers as following:

extern void a(void);
extern void b(void);

void fptr(void *fp)
{
if (fp == a)
a();
if (fp == b)
b();
}

void main(void)
{
void *fp;
fp = (void *)a; //or b
fptr(fp);
}