#include <stdio.h> #include <stdlib.h> typedef struct _clase{ int a; void(*func[3])(struct _clase*); } clase; void clase_func1 (struct _clase *p){ printf("Funcion 1: %i\n",p->a); } void clase_func2 (struct _clase *p){ printf("Funcion 2: %i\n",p->a); } void clase_func3 (struct _clase *p){ printf("Funcion 3: %i\n",p->a); } void holaMundo(){ printf("Hola Mundo!\n"); } typedef void(*func) (void); int main(int argc, char *argv[]) { func val; clase c; c.func[1]=&clase_func1; c.func[2]=&clase_func2; c.func[0]=&clase_func3; val=&holaMundo; val(); c.a=1; c.func[0](&c); c.a=2; c.func[1](&c); c.a=3; c.func[2](&c); system("PAUSE"); return 0; }
You need to create an account or log in to post comments to this site.