C++ - 函数指针
1 #include <iostream> 2 #include <tchar.h> 3 #include <Windows.h> 4 5 using namespace std; 6 7 void Test( int a) 8 { 9 cout << "Test函数: " << a << endl; 10 } 11 12 // 函数指针1 13 void (*testFunction1)(int ) = Test; 14 15 // 函数指针2 16 typedef void (*TEST)(int); 17 TEST testFunction2 = Test; 18 19 int main() 20 { 21 testFunction1(5555); 22 testFunction2(6666); 23 getchar(); 24 return 0; 25 }

浙公网安备 33010602011771号