Hi everyone
I am interested in having multiple functions with different prototypes
and deciding, by setting a pointer, which of them to use later in the
program.
Eg:
int f1(void);
char* f2(int);
/* ... many more of these to choose from */
/* ? correct declaration of generic_ptr ? */
if (/*...*/)
generic_ptr = f1;
else
generic_ptr = f2;
generic_ptr(/* using correct args */)
How should I define generic_ptr? Is (void*) ok? It seems to work on my
machine, but I would like to know if this is standard/portable.
Thank you for any help
Juergen
I am interested in having multiple functions with different prototypes
and deciding, by setting a pointer, which of them to use later in the
program.
Eg:
int f1(void);
char* f2(int);
/* ... many more of these to choose from */
/* ? correct declaration of generic_ptr ? */
if (/*...*/)
generic_ptr = f1;
else
generic_ptr = f2;
generic_ptr(/* using correct args */)
How should I define generic_ptr? Is (void*) ok? It seems to work on my
machine, but I would like to know if this is standard/portable.
Thank you for any help
Juergen
Comment