title: C: How can I use a single function pointer array for functions with variable parameter counts?
body: <p>The question pretty much says it all.</p>
  
  <p>I'm not sure how to do this and haven't come anywhere near anything that works.</p>
  
  <p>Here's some example functions:</p>
  
  <pre><code>add(int x, int y) {
    return x+y;
  }
  </code></pre>
  
  <p>and,</p>
  
  <pre><code>mean(int x1, int y1, int x2, int y2) {
    return (x1 + y1 + x2 + y2) / 4;
  }
  </code></pre>
  
  <p>So far I've tried using typedef with both, but I can't figure how to make something point to one of either type:</p>
  
  <pre><code>typedef int (*mathfunc2)(int x, int y);
  typedef int (*mathfunc4)(int x1, int y1, int x2, int y2);
  
  ????? func_table[2] = {add, mean};
  </code></pre>