更新时间:2022-06-24 21:42:41
这是一个功能服用声明的 INT
和一个指向一个函数(取 INT
返回void),并返回一个指针的函数(取 INT
键,返回void)。
It's the declaration of a function taking an int
and a pointer to a function (taking int
returning void) and returning a pointer to a function (taking int
and returning void).
的说明,或引导间pretation
您可以通过将一个单一的实体在括号治疗的一切,然后使用向内工作间preT声明如下用途规则。
You can interpret by treating everything in parentheses as a single entity and then working inwards using the "declaration follows usage" rule.
无效(*信号(INT SIG,无效(* FUNC)(INT)))击>(INT);
在括号中的实体看起来像一个函数以 INT
并返回无效
。
The entity in the brackets looks like a function taking int
and returning void
.
剥去外面部分:
*signal(int sig, void (*func)(int))
因此,信号
需要一些参数,返回的东西,可以解除引用(由于领先 *
)以形成功能以 INT
并返回无效
。
So, signal
takes some parameters and returns something that can be dereferenced (due to the leading *
) to form a function taking int
and returning void
.
这意味着信号
返回一个指针函数的函数(取 INT
并返回无效
)。
This means signal
is a function returning a pointer to a function (taking int
and returning void
).
看着它需要一个 INT
(即 SIG
)和无效的参数( * FUNC)(INT)
这是一个指向一个函数(取 INT
并返回无效
)。
Looking at the parameters it takes an int
(i.e. sig
) and void (*func)(int)
which is a pointer to a function (taking int
and returning void
).