title: C Programming: Forward variable argument list
body: <p>I'm trying to write a function that accepts a variable number of parameters like printf, does some stuff, then passes the variable list to printf. I'm not sure how to do this, because it seems like it would have to push them onto the stack. </p>
  
  <p>Something approximately like this</p>
  
  <p><a href="http://pastie.org/694844" rel="noreferrer">http://pastie.org/694844</a></p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdarg.h&gt;
  
  void forward_args( const char *format , ... ){
    va_list arglist;
    printf( format, arglist );
  }
  
  
  int main (int argc, char const *argv[]){
    forward_args( "%s %s\n" , "hello" , "world" );  return 0;
  }
  </code></pre>
  
  <p>Any ideas?</p>