title: Variable argument lists in C functions - How to properly iterate through the arg list?
body: <p>In the following C program i get the warning:  </p>
  
  <p><code>warning #2030: '=' used in a conditional expression.</code></p>
  
  <p>What exactly is the problem and how do i avoid this? What is the correct way to iterate through the variable arguments?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdarg.h&gt;
  
  int Sum(int a, int b, ...)
  {
      int arg;
      int Sum = a + b;
  
      va_list ap;
      va_start(ap, b);
  
      while(arg = va_arg(ap, int))
      {
          Sum += arg;
      }
      va_end(ap);
  
      return Sum;
  }
  
  int main(int argc, char *argv[])
  {
      printf("%d\n", Sum(1, 2, 4, 8));
  
      return 0;
  }
  </code></pre>