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(); }
Call back function implement
时间: 2024-11-05 21:35:43