I don't know how to accomplish this!
how to get the function pointer in va_list arguments?
thanks so much.
Typedefs often make working with function pointers easier, but are not necessary.
#include <stdarg.h>
void foo(int count, ...) {
va_list ap;
int i;
va_start(ap, count);
for (i = 0; i < count; i++) {
void (*bar)() = va_arg(ap, void (*)());
(*bar)();
}
va_end(ap);
}
Use a typedef for the function pointer type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With