title: How are complicated expression using the comma operator parsed in C?
body: <p>After reading both of the following...</p>
  
  <p><a href="https://stackoverflow.com/questions/52550/what-does-the-comma-operator-do">What does the comma operator , do?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/54142/how-does-the-comma-operator-work">How does the Comma Operator work</a></p>
  
  <p>I am still not sure that I can't parse the following statement that I found in someone else's source code:</p>
  
  <pre><code>int i, n, val, locala = a, bestval = -INFINITY;
  </code></pre>
  
  <p>The comma operator is evaluated in left-to-right ordering, yes? If we use parentheses to show order of precedence, I think we have something like this:</p>
  
  <pre><code>(int i, (n, (val, (locala = a, (bestval = -INFINITY)))));
  </code></pre>
  
  <p>So, maybe, the original is equivalent to the following?</p>
  
  <pre><code>int bestval = -INFINITY;
  int locala = a;
  int val;
  int n;
  int i;
  </code></pre>
  
  <p>If so, why is the <code>int</code> keyword applied to all of the variables instead of only the leftmost variable <code>i</code>?</p>
  
  <p>Also, the right-most expressions return their value, yes? So, <code>locala = a</code> might return the value of <code>locala</code> after the assignment is takes place. Does that mean that the variables <code>i</code>, <code>n</code>, and <code>val</code> all get initialized? If so, what do they get initialized to? <code>-INFINITY</code>? the value of <code>a</code>?</p>