Order of executions in C++ streams
<p>It is obvious that first cout prints 7 7 but why the second one prints  8 8 7 ? Why not 7 8 8? How does such constructions work in c++?</p>

<pre class="lang-c prettyprint-override"><code>int ink(int *x){
     *x += 1;
     return *x;
}
</code></pre>

<pre class="lang-c prettyprint-override"><code>int main(){
    int *a;
    int b = 6;

    a = &amp;b;

    cout &lt;&lt; ++b &lt;&lt; " " &lt;&lt; b &lt;&lt; endl;   
    cout &lt;&lt; b &lt;&lt; " " &lt;&lt; ink(a) &lt;&lt; " " &lt;&lt; b;

    return 0;
</code></pre>

<p>}</p>
