c++ - How to pass array of function pointers to another function -
i have got 2 functions:
char* odwroc(char* nap, int n) char* male(char* nap, int n)
i have defined pointer kind functions
typedef char*(*pointertofunction )( char*, int );
then in used definition in main:
pointertofunction ptr1 = odwroc; pointertofunction ptr2 = male;
but have create function first parameter gets array of pointers function , stuck. don't know how define array of pointers function , how modyfikuj
parameter list should like.
void modyfikuj(char* pointertofunction *pointerarray, int length, char* nap2, int n){ }
try this:
pointertofunction mojefunkcje[] = { odwroc, male}; modyfikuj( mojefunkcje, ...); // pass array fo modyfikuj() void modyfikuj( pointertofunction* funtab, ...) { funtab[0]( string, liczba); // call odwroc( string, liczba) funtab[1]( string, liczba); // call male( string, liczba) }
Comments
Post a Comment