13.03.2013, 01:16, "James Bowman" <jamesb@xxxxxxxxxxxx>: > This works, and is perhaps close to the idea: > > #include <stdio.h> > > typedef void (*funcptr)(); > > funcptr test_print(int pick) > { > void test_print1() > { > printf("print1\n"); > } > void test_print2() > { > printf("print2\n"); > } > return (pick == 1) ? test_print1 : test_print2; > } > > int main () > { > funcptr ep1 = test_print(1); > funcptr ep2 = test_print(2); > > ep1(); > ep2(); > > return 0; > } > > -- > James Bowman > http://www.excamera.com/ No. It prints: print1 print2 It should print: print1 print2 print2 This is what I want to do: #include <stdio.h> typedef void (*funcptr)(); void test_print1() { printf("print1\n"); } void test_print2() { printf("print2\n"); } void eval_ptr(funcptr *a) { while (*a != NULL) { (*a)(); a++; } } int main () { funcptr ep1[3] = {test_print1, test_print2, NULL}; funcptr ep2[2] = {test_print2, NULL}; eval_ptr(ep1); eval_ptr(ep2); return 0; } But i need it in one function with two entry point. I can code this in assembly, but not in C