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.
我正在浏览 XCB 资源,发现了这个奇怪的结构成员:
void (*return_socket)(void *closure);
这意味着什么?写这个的另一种方式是什么?
那是一个函数指针。它指向一个函数,该函数返回void并接收一个void *as 参数。
void
void *
例如,您可以将其用作:
void myFunction(void *closure) { printf("myFunction called with closure=%p", closure); } void (*return_socket)(void *closure) = myFunction;