[prev] 48 [next]

Exercise 5: Fun with Function Pointers

Function pointers can be passed around, assigned, etc.
(just like other pointer values)

Write a program that

  • builds an array of names for functions
  • builds a parallel array of pointers to the functions
  • iterates over this array, applying the functions
And another program that does the same, except
  • uses an array of structs like (name,funcPtr)