gpt4 book ai didi

c++ - 在 C++ 中调用函数指针指向的函数的方法

转载 作者:行者123 更新时间:2023-11-28 07:45:24 27 4
gpt4 key购买 nike

<分区>

我注意到在 C++ 中有两种调用函数指针的方法。

示例代码:

void A(int x){
...
...
}

main() {
void (*f)(int);
f=&A;
f(); //Method 1
(*f)(); //Method 2
}

为什么方法 1 和 2 都有效?两种方法具有相同行为的逻辑是什么?

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com