title: Pre increment and post increment
body: <p>I'm having trouble understanding how Post Increment (<code>++</code>), Pre Increment (<code>--</code>) and addition/subtraction work together in an example.</p>
  
  <p><code>x++</code> means add 1 to the variable.</p>
  
  <p><code>x--</code> means subtract 1 from the variable.</p>
  
  <p><strong>But I am confused with this example:</strong></p>
  
  <pre><code>int x = 2, y = 3, z = 1;`
  
  y++ + z-- + x++;
  </code></pre>
  
  <p>I assume this means <code>3(+1) + 1(-1) + 2(+1)</code> Which means the result should be 7.</p>
  
  <p>But when I compile it, I get <code>6</code>.  I don't understand.</p>
  
  <pre><code>int main() {
    int x=2, y=3, z=1;
    int result;
  
    result = y++ + z-- + x++;    //this returns 6
  
    cout &lt;&lt; result &lt;&lt; endl;
    return 0;
  }
  </code></pre>