c pass function as function parameter
#include <iostream> using namespace std; void printNum(int x); void invokeFunc2(void (*funcName)(int)); int main() { invokeFunc2(&printNum); return 0; } void invokeFunc2(void (*funcName)(int)) { int x=100; (*funcName)(x); } void printNum(int x) { for(int i=0;i<100;i++) { cout<<"x="<<++x<<endl; sleep(1); } cout<<"Finished in printNum()!"<<endl; }