title: How to loop through a va_list if the number of arguments is unknown?
body: <p>How do I loop through a va_list if the number of additional arguments is unknown? 
  </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdarg.h&gt;
  
  int add(int x, int y, ...) {
      va_list intargs;
      int temp = 0;
  
      va_start(intargs, y);
      int i;
      for (i = 0; i &lt; 3; i++) { /* How can I loop through any number of args? */ 
          temp += va_arg(intargs, int);
      }
      va_end(intargs);
  
      return temp + x + y;
  }
  
  int main() {
      printf("The total is %d.\n", add(1, 2, 3, 4, 5));
      return 0;
  }
  </code></pre>