title: C++ Declaring An Array Of Function Pointers
body: <p>Basically I need to implement an event handler class, but run into an error that I cannot declare an array of voids:</p>
  
  <pre><code>class SomeClass
  {
  public:
      void registerEventHandler(int event, void (*handler)(std::string));
  
  private:
      // here i get this error: declaration of ‘eventHandlers’ as array of void
      void (*eventHandlers)(std::string)[TOTAL_EVENTS];
  }
  
  void SomeClass::registerEventHandler(int event, void (*handler)(std::string))
  {
      eventHandlers[event] = handler;
  }
  
  
  
  void handler1(std::string response)
  {
      printf("ON_INIT_EVENT handler\n");
  }
  void handler2(std::string response)
  {
      printf("ON_READY_EVENT handler\n");
  }
  
  void main()
  {
      someClass.registerEventHandler(ON_INIT_EVENT, handler1);
      someClass.registerEventHandler(ON_READY_EVENT, handler2);
  }
  </code></pre>
  
  <p>Can you help me figure out the exact syntax?
  Thanks!</p>