使用功能没有指针的函数原型 [英] function prototype using in function without pointer
问题描述
我的教练使用功能与其他功能参数提及。 (我不是指使用指针。这可能吗?我告诉下)我不明白他做了什么。谁能举例解释一下吗?谢谢大家AP preciated答案。
My instructor mentioned using function as parameter in other function. (I don't mean using pointers. Is it possible ? I show below) I don't understand what he did. Can anyone explain with examples ? Thank you all appreciated answers.
是:
int test(double abc(double)){
// bla bla
}
功能是:
double abc(double n){
// function main
}
例子是我写的,我不敢肯定他们是对的。
The examples is written by me I'm not so sure they're right.
推荐答案
这个函数的声明:
int test(double abc(double))
{
// bla bla
}
相当于:
int test(double (*abc)(double))
{
// bla bla
}
的 ABC
参数是函数指针类型的参数(双(*)(双))
)。
The abc
parameter is a parameter of function pointer type (double (*)(double))
).
有关C标准的参考:
(C99,6.7.5.3p8)函数返回类型为应调整到指针函数返回类型参数为的声明,如6.3.2.1。
(C99, 6.7.5.3p8) "A declaration of a parameter as "function returning type" shall be adjusted to "pointer to function returning type", as in 6.3.2.1."
这篇关于使用功能没有指针的函数原型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!