We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Bahri Okuroglu Turning off overlaying to use function pointers has a heavy ram size price. Since function pointers are tricky to use, I suggest the following technique. This technique has 2 advantages. The call tree is built automatically by the linker. Also you need only save and pass a char enum instead of a larger function pointer. This usually offsets the cost of the extra array evaluation.
extern char Fn1( char, char ); extern char Fn2( char, char ); extern char Fn3( char, char ); typedef char FnT( char, char ); enum {eFn1, eFn2, eFn3 }; FnT* code pFns[] = { &Fn1, &Fn2, &Fn3 }; void main( void ) { char a = (*pFns[ eFn2 ])( 1, 100 ); }