摘要:
有时我们需要将函数作为结构体的成员,模拟C++类的情形,可应用于方法注册。#include <stdio.h>struct a{ void (*func)(char *);};void hello(char *name){ printf ("hello %s\n",name);}int main(){ struct a a1; a1.func = hello; a1.func("illusion"); system("PAUSE"); return 0;} 阅读全文
posted @ 2012-05-14 15:50
alaigle
阅读(538)
评论(0)
推荐(0)

浙公网安备 33010602011771号