解释无效(*信号(INT SIGNO,无效*(FUNC)(INT)))(INT) [英] Explain void (*signal(int signo, void *(func)(int)))(int)

查看:226
本文介绍了解释无效(*信号(INT SIGNO,无效*(FUNC)(INT)))(INT)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请解释一下这种类型的签名:无效(*信号(INT SIGNO,无效*(FUNC)(INT)))(INT)

Please explain this type signature : void (*signal(int signo, void *(func)(int)))(int)

推荐答案

信号的类型签名功能更清晰一点,当一个typedef用于功能被传来传指针:

The type signature of the signal function is a bit more clear when a typedef is used for the function pointers that are passed around:

typedef void (*sighandler_t)(int);
sighandler_t signal(int signo, sighandler_t func);

sighandler_t 是一个指针,它接受一个 INT 参数并没有返回值的函数。在信号函数有这样一个函数指针作为其第二个参数。它也返回该类型的函数指针。

sighandler_t is a pointer to a function that takes an int parameter and returns nothing. The signal function takes such a function pointer as its second parameter. It also returns a function pointer of that type.

这篇关于解释无效(*信号(INT SIGNO,无效*(FUNC)(INT)))(INT)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆