Why does this int and string concatenation give this output in C++
<pre><code>for(int i=0;i&lt;10;i++)
{
  cout &lt;&lt; i+"passs" &lt;&lt; "\n";
}
</code></pre>

<p>This produces output as follows:</p>

<pre><code>passs
asss
sss
ss
s
</code></pre>

<p>Now my thinking is that we are seeing a pointer manipulation where the counter i gets added to passs char pointer and we are seeing output from "passs" pointer+0,"passs" pointer+1 etc.</p>

<p>Question beckons as to why it does not stop when it reaches null character, coz it prints 5 blank lines.</p>

<p>Next is the <code>cout &lt;&lt; "passs"+i &lt;&lt; "\n";</code> prints the same thing. I thought this should have printed all blank lines from second position as this time the passs pointer should have been probably from last position. On reading what I wrote here, it probably makes sense to see that the output for the 2nd cout would be the way it is.</p>

<p>I wanted to know if I'm thinking correctly and if there is more to this which I've not comprehended?</p>
