title: C - call function with dynamic number of arguments
body: <p>I have a C function with a specific number of arguments (not a varargs function). Eg:</p>
  
  <pre><code>void testfunction(int a, int b, int c);
  </code></pre>
  
  <p>This function is a black-box, so I can't modify it.</p>
  
  <p>In the main function I have an array containing all the arguments that I want to pass to my "testfunction". Eg:</p>
  
  <pre><code>void main() {
      int args[] = {1, 2, 3};
      ...
  }
  </code></pre>
  
  <p>Assuming that I don't know in advance what is the number of arguments that my "testfunction" will accept (because this function can change, depending on the function that I want to test), how can I call "testfunction" with the arguments in the array dynamically defined? </p>
  
  <p>I have some experience in Ruby, it would be the equivalent of</p>
  
  <pre><code>def test(a, b, c)
      ...
  end
  array = [1,2,3]
  test(*array)
  </code></pre>
  
  <p>Thanks you a lot!</p>