[prev] 46 [next]

Programming: Function Pointers

applyToList(L,F) is a function that has another function as argument

C does not provide explicit support for such functions (cf. Haskell)

However, can "pass" functions by passing a pointer to them.

E.g. a pointer to a function mapping intint

int (*fun)(int)

E.g. a pointer to a function mapping a char and int to a string

char *(*fun2)(char,int);