//here is a simple demo:
#include <iostream>
using namespace std;
void fun(void (*p_fun)());//attention: here '(*p_fun)' ,the parentheres cannot be omitted
//this means 'p_fun' is a function pointer
void fun1();
void fun2();
int main() {
fun(fun1);
fun(fun2);
return 0;
}
void fun1(void) {
cout<<"this is fun1!"<<endl;
}
void fun2(void) {
cout<<"this is fun2!"<<endl;
}
void fun(void (*p_fun)()) {
(*p_fun)();
}