首页 > 试题广场 >

有以下程序#include us...

[单选题]
有以下程序
#include <iostream>
using namespace std;
void (*function)(float);

void One(float one) {
    cout<<"1"<<endl;
}

void Two(float two) {
    cout<<"2"<<endl;
}

void Three(float three) {
    cout<<"3"<<endl;
}

int main() {
    float i=1,j=2,k=3;
    function = One;
    function(i);
    function= Two;
    function(j);
    function = Three;
    function(k);
}
请为横线处选择合适的程序使得程序的运行结果是123 ()
  • void *function();
  • void *function(float);
  • void (*function)();
  • void (*function)(float);
请问横线在哪?
发表于 2022-01-07 16:20:34 回复(2)
void (*function)(float);指向函数的指针
void *function(float);返回指针值的函数
发表于 2020-09-02 19:08:20 回复(2)
出的很好 下次不要在出了
发表于 2022-03-29 12:44:27 回复(0)
哪个大佬会,指点一下。
发表于 2023-06-28 16:41:33 回复(0)
找半天横线,然后发现是第三行忘删了
发表于 2023-09-26 16:52:32 回复(0)
这题也太秀了
发表于 2022-09-20 17:35:16 回复(0)
我服了
发表于 2022-05-26 21:32:03 回复(0)
回调函数。所谓的横线,就是第3行置空。
发表于 2022-05-08 03:09:29 回复(0)
是我瞎了吗?
发表于 2022-02-18 00:52:37 回复(0)