Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我不知道如何做到这一点! 如何在 va_list 参数中获取函数指针? 非常感谢。
Typedefs 通常使函数指针的工作更容易,但不是必需的。
#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); }
对函数指针类型使用 typedef。