If I have a char * variable pointing to the name of a function, how can I call that function?
The most straightforward thing to do is to maintain a correspondence table of names and function pointers:
int func(), anotherfunc();
struct { char *name; int (*funcptr)(); } symtab[] = {
"func", func,
"anotherfunc", anotherfunc,
};
Then,
search the table for the name, and call
via
the
associated function pointer.
See also questions
2.15
and
19.36.
References:
PCS Sec. 11 p. 168
Read sequentially: prev next up top
This page by Steve Summit // Copyright 1995 // mail feedback