Arrays of functions - calling them with different number of args.

Ben Liblit BRL102 at psuvm.psu.edu
Wed Mar 7 01:25:00 AEST 1990


In article <8553 at cbnewsh.ATT.COM>, ijk at cbnewsh.ATT.COM (ihor.j.kinal) says:
>
>I've set up an array of 50 functions, to be called with one standard
>argument, and my function call looks like this [which particular
>function to be called is determined by the action_ind.
>
>                        action_tbl [ action_ind ] ( one_arg )
>
>        where the one_arg is a pointer to a particular type.
>
>Now, I want to add some functions that will have two arguments.

The best solution I can think of is to stick with a single argument, but make
one_arg a void pointer.  A particular function will typecast one_arg to a
pointer to a structure containing the actual parameters to be used.  Make any
sense?

                      Ben Liblit
                      BRL102 @ psuvm.bitnet -- BRL102 @ psuvm.psu.edu
                      "Fais que tes reves soient plus longs que la nuit."



More information about the Comp.lang.c mailing list