1 #include <iostream>
 2 using namespace std;
 3 
 4 void show(int a);
 5 int main(int argc, char *argv[])
 6 {
 7     void (* pfunc)(int a) = NULL;
 8     pfunc = show;
 9     pfunc(886);
10     return 0;
11 }
12 
13 void show(int a)
14 {
15     int b = new int(a);
16     cout << b;
17 }

一个简单的小程序,显示函数指针的用法,以及new初始化。

相关文章:

  • 2021-10-30
  • 2022-12-23
  • 2022-01-06
  • 2021-09-16
  • 2022-12-23
  • 2021-07-24
  • 2021-11-06
  • 2021-09-05
猜你喜欢
  • 2021-10-12
  • 2021-05-26
  • 2021-06-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案