首页 > 代码库 > Call back function implement

Call back function implement

Call back function easily implement

 

 

#include <stdio.h>void HelloWorld(int nIndex){       printf("%d person say Hello World\n",nIndex);} void MyName(int len){       printf("My name is 萧%d郎", len);} void callback(int i, void (* print)(int)){          print(i);}void main(void){       callback(10,HelloWorld);       callback(11, MyName);       getchar();}