Calling functions by address
Dave Jones
djones at megatest.UUCP
Wed Aug 31 09:00:35 AEST 1988
>From article <679 at mssx.UUCP>, by src at mssx.UUCP (Pleschutznig Andreas):
...
>
> So we thought of doing that job by declaring the addresses of the emulation
> routines and jumping to the routines by address like this
>
> (*addressarray[code]);
>
> I know, I know that *does not* work, but maybe there is someone knowing to
> get around.
Nothing to "get around". There is nothing in your way. You just left off
the empty parameter list (). (First language Pascal?)
/* declaration */
int routine1(), routine2(), routineN();
int (*addressarray[])() = { routine1, routine2, routineN };
/* calling sequence */
int return_value = (*addressarray[code])();
More information about the Comp.lang.c
mailing list